cover config types better
This commit is contained in:
parent
6c33b81610
commit
fb60b09db8
|
@ -7,6 +7,7 @@ import { NotFoundError } from '../../../src/error/NotFoundError';
|
|||
import { describeLeaks, itLeaks } from '../../helpers/async';
|
||||
|
||||
const TEST_ROOT = '../test/config/type';
|
||||
const CONFIG_MISSING = 'missing.yml';
|
||||
|
||||
describeLeaks('include config type', async () => {
|
||||
itLeaks('should resolve existing files', async () => {
|
||||
|
@ -15,7 +16,7 @@ describeLeaks('include config type', async () => {
|
|||
|
||||
itLeaks('should throw when resolving missing files', async () => {
|
||||
expect(() => {
|
||||
includeType.resolve(join(TEST_ROOT, 'missing.yml'));
|
||||
includeType.resolve(join(TEST_ROOT, CONFIG_MISSING));
|
||||
}).to.throw(NotFoundError);
|
||||
});
|
||||
|
||||
|
@ -25,7 +26,13 @@ describeLeaks('include config type', async () => {
|
|||
|
||||
itLeaks('should throw when constructing missing files', async () => {
|
||||
expect(() => {
|
||||
includeType.construct(join(TEST_ROOT, 'missing.yml'));
|
||||
includeType.construct(join(TEST_ROOT, CONFIG_MISSING));
|
||||
}).to.throw(BaseError);
|
||||
});
|
||||
|
||||
itLeaks('should throw when resolving missing files', async () => {
|
||||
expect(() => {
|
||||
includeType.resolve(join(TEST_ROOT, CONFIG_MISSING));
|
||||
}).to.throw(BaseError);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { expect } from 'chai';
|
||||
|
||||
import { regexpType } from '../../../src/config/type/Regexp';
|
||||
import { InvalidArgumentError } from '../../../src/error/InvalidArgumentError';
|
||||
import { describeLeaks, itLeaks } from '../../helpers/async';
|
||||
|
||||
describeLeaks('regexp config type', async () => {
|
||||
|
@ -21,7 +22,11 @@ describeLeaks('regexp config type', async () => {
|
|||
expect(regexpType.resolve('/foo/notrealflags')).to.equal(false);
|
||||
});
|
||||
|
||||
itLeaks('should not match regex embedded in a longer string', async () => {
|
||||
expect(regexpType.resolve('some/regex/with-padding')).to.equal(false);
|
||||
itLeaks('should not match regexp embedded in a longer string', async () => {
|
||||
expect(regexpType.resolve('some/regexp/with-padding')).to.equal(false);
|
||||
});
|
||||
|
||||
itLeaks('should throw when constructing an invalid regexp', async () => {
|
||||
expect(() => regexpType.construct('/foo/notrealflags')).to.throw(InvalidArgumentError);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue