nx/packages/angular/spec/testing-utils.spec.ts
Jason Jean e06822da7e
chore(repo): update prettier to v2 (#2934)
this is just for the repo, and not the workspace

Co-authored-by: Rares Matei <matei.rar@gmail.com>
2020-04-29 01:09:37 -04:00

27 lines
659 B
TypeScript

import { from } from 'rxjs';
import { readAll, readFirst } from '../testing/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();
});
});
});