From 87e55c873b89a1a34581ed3c7f1f59a76808b8ff Mon Sep 17 00:00:00 2001 From: ssube Date: Tue, 31 Mar 2020 17:47:10 -0500 Subject: [PATCH] fix(test): cover app main and stream type --- test/TestApp.ts | 7 +++++++ test/type/TestStream.ts | 26 ++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 test/TestApp.ts create mode 100644 test/type/TestStream.ts diff --git a/test/TestApp.ts b/test/TestApp.ts new file mode 100644 index 0000000..dd9820d --- /dev/null +++ b/test/TestApp.ts @@ -0,0 +1,7 @@ +import { expect } from 'chai'; + +import { main } from '../src/app'; + +describe('main function', async () => { + it('should exit 1', async () => expect(main([])).to.eventually.equal(1)); +}); diff --git a/test/type/TestStream.ts b/test/type/TestStream.ts new file mode 100644 index 0000000..ea7621b --- /dev/null +++ b/test/type/TestStream.ts @@ -0,0 +1,26 @@ +import { NotFoundError } from '@apextoaster/js-utils'; +import { expect } from 'chai'; + +import { streamType } from '../../src/type/Stream'; + +describe('stream config type', async () => { + it('should resolve existing streams', async () => { + expect(streamType.resolve('stdout')).to.equal(true); + }); + + it('should reject missing streams'); + it('should reject other properties', async () => { + expect(() => streamType.resolve('env')).to.throw(NotFoundError); + }); + + it('should construct streams from process', async () => { + expect(streamType.construct('stdout')).to.equal(process.stdout); + }); + + /** + * TODO: throw + */ + it('should throw when constructing missing streams', async () => { + expect(streamType.construct('bob')).to.equal(undefined); + }); +});