oa-jira
Version:
Octet Agile's JIRA connectivity project.
30 lines (27 loc) • 1.1 kB
JavaScript
const commons = require('../../../../src/commons/');
const Prohibited = require('../../../../src/commons/errors/prohibited.error');
describe('Check [Prohibited] class', () => {
describe('Check constructor', () => {
it.each([
[undefined, undefined],
[2, 4],
['thing', 'stuff']
])('should return new instance when what is [%s] and denied is [%s]', (what, denied) => {
expect(commons.errors.prohibited.new(what, denied)).toBeInstanceOf(Prohibited);
expect(commons.errors.prohibited.new(what, denied).message).toEqual(
`A [${what}] equals to [${denied}] is prohibited.`
);
});
});
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 denied is [%s].', async (what, denied) => {
expect(commons.errors.prohibited.reject(what, denied)).rejects.toEqual(new Prohibited(what, denied));
});
});
});
});