Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/devsu/jasmine-spy
Helper that works a shortcut to create jasmine spies that return values or promises
https://github.com/devsu/jasmine-spy
Last synced: about 2 months ago
JSON representation
Helper that works a shortcut to create jasmine spies that return values or promises
- Host: GitHub
- URL: https://github.com/devsu/jasmine-spy
- Owner: devsu
- License: mit
- Created: 2017-02-14T21:15:00.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-02-14T21:30:12.000Z (almost 8 years ago)
- Last Synced: 2024-09-18T17:49:37.896Z (4 months ago)
- Language: JavaScript
- Size: 2.93 KB
- Stars: 1
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# jasmine-spy
Helper that works as a shortcut to create jasmine spies that return values or promises## Installation
```bash
npm i --save-dev jasmine
npm i --save-dev jasmine-spy
```## Usage
```js
const Spy = require('jasmine-spy');describe('your test', () => {
let myStub;
beforeEach(() => {
myStub = {
'doSomething': Spy.create(),
'doSomethingElse': Spy.returnValue('a'),
'anotherMethod': Spy.resolve('the result'),
'yetAnotherMethod': Spy.reject('some error'),
'oneMore': Spy.returnValues('a', 'b', 'c'),
'another': Spy.throwError('something went wrong'),
};
});
});
```## Credits and License
Developed by [Devsu](https://devsu.com). Copyright 2017.
MIT license.