1.2.0 • Published 2 years ago

rx-spy-util v1.2.0

Weekly downloads
3
License
MIT
Repository
github
Last release
2 years ago

rx-spy-util

Collect all your spies to observable values in one util. SpyUtil helps you keep track on each call without all that boilerplate code

Usage

For extended excamples, see main.spec.ts

const key =  'someKey';
const spyUtil: SpyUtil = new SpyUtil();
// before each
spyUtil.spySubscribe(service.someObservable, key);
spyUtil.spyException(service.someObservable, 'someOtherId');

....
// tests
expect(spyUtil.get(key)).toHaveBeenCalledTimes(1) ...
expect(spyUtil.get('someOtherId')).not.toHaveBeenCalled() ...
expect(spyUtil.allCounts()).toEqual([1, 0]) ...
expect(spyUtil.argsFor(key, 0).toEqual('some string')) ...
expect(spyUtil.lastOf(key).toEqual('some string')) ...
...
// after each
spyUtil.unsubscribe() ...

Test

$> npm i && npm test

Dependencies

Your project should have rxjs,and jasmine installed - these are omitted in the bundle to avoid version conflicts

Todo

karma singleRun=false not working

1.2.0

2 years ago

1.1.2

4 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.0

5 years ago

0.0.0-1

5 years ago