fix(test): cover app main and stream type
This commit is contained in:
parent
c1189a8569
commit
87e55c873b
|
@ -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));
|
||||
});
|
|
@ -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);
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue