oa-jira
Version:
Octet Agile's JIRA connectivity project.
30 lines (27 loc) • 1.14 kB
JavaScript
const commons = require('../../../../src/commons/');
const InvalidClass = require('../../../../src/commons/errors/invalid.class.error');
describe('Check [Invalid Class] class', () => {
describe('Check [new] static utility.', () => {
it.each([
[undefined, undefined],
[2, 4],
['thing', 'stuff']
])('should return new instance when what is [%s] and expected is [%s]', (what, expected) => {
expect(commons.errors.invalid.class.new(what, expected)).toBeInstanceOf(InvalidClass);
expect(commons.errors.invalid.class.new(what, expected).message).toEqual(
`A [${what}] MUST implements [${expected}].`
);
});
});
describe('Check static utilities.', () => {
describe('Check [reject] static utility', () => {
it.each([
[undefined, undefined],
[2, 4],
['thing', 'stuff']
])('should reject new instance when what is [%s] and expected is [%s].', async (what, expected) => {
expect(commons.errors.invalid.class.reject(what, expected)).rejects.toEqual(new InvalidClass(what, expected));
});
});
});
});