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); + }); +});