From 78ea2e92eed689ba318b29a63a39d997c732d36c Mon Sep 17 00:00:00 2001 From: "Austin M. Matherne" Date: Wed, 30 Aug 2017 22:56:03 -0500 Subject: [PATCH] Create tests for testing helpers --- packages/nx/spec/testing-utils.spec.ts | 27 ++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 packages/nx/spec/testing-utils.spec.ts diff --git a/packages/nx/spec/testing-utils.spec.ts b/packages/nx/spec/testing-utils.spec.ts new file mode 100644 index 0000000000..ab18dbfa2e --- /dev/null +++ b/packages/nx/spec/testing-utils.spec.ts @@ -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 to Promise>', 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 to Promise', async (done) => { + const obs = from([1, 2, 3]); + const result = await readFirst(obs); + + expect(result).toBe(1); + + done(); + }); + }); +}); +