Create tests for testing helpers
This commit is contained in:
parent
ceafd04991
commit
78ea2e92ee
27
packages/nx/spec/testing-utils.spec.ts
Normal file
27
packages/nx/spec/testing-utils.spec.ts
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
import {from} from 'rxjs/Observable/from'
|
||||||
|
import {readAll, readFirst} from '../src/testing-utils';
|
||||||
|
|
||||||
|
describe('TestingUtils', () => {
|
||||||
|
describe('readAll', () => {
|
||||||
|
it('should transform Observable<T> to Promise<Array<T>>', async (done) => {
|
||||||
|
const obs = from([1, 2, 3]);
|
||||||
|
const result = await readAll(obs);
|
||||||
|
|
||||||
|
expect(result).toEqual([1, 2, 3]);
|
||||||
|
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('readFirst', () => {
|
||||||
|
it('should transform first item emitted from Observable<T> to Promise<T>', async (done) => {
|
||||||
|
const obs = from([1, 2, 3]);
|
||||||
|
const result = await readFirst(obs);
|
||||||
|
|
||||||
|
expect(result).toBe(1);
|
||||||
|
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user