Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

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.