oa-jira
Version:
Octet Agile's JIRA connectivity project.
41 lines (35 loc) • 1.74 kB
JavaScript
const Missing = require('../../../src/commons/errors/missing.error');
const InvalidType = require('../../../src/commons/errors/invalid.type.error');
const TooBig = require('../../../src/commons/errors/too.big.error');
const TooSmall = require('../../../src/commons/errors/too.small.error');
const Prohibited = require('../../../src/commons/errors/prohibited.error');
const commons = require('../../../src/commons');
describe('Check [commons] index', () => {
describe('Check [error] services', () => {
describe('Check [when missing] service', () => {
it('should rejects new instance of missing error', () => {
expect(commons.errors.missing.reject('w')).rejects.toEqual(new Missing('w'));
});
});
describe('Check [when invalid type] service', () => {
it('should rejects new instance of invalid type error', () => {
expect(commons.errors.invalid.type.reject('w', 'e')).rejects.toEqual(new InvalidType('w', 'e'));
});
});
describe('Check [when too small] service', () => {
it('should rejects new instance of too small error', () => {
expect(commons.errors.too.small.reject('w', 1)).rejects.toEqual(new TooSmall('w', 1));
});
});
describe('Check [when too big] service', () => {
it('should rejects new instance of too big error', () => {
expect(commons.errors.too.big.reject('s', 4)).rejects.toEqual(new TooBig('s', 4));
});
});
describe('Check [when prohibited] service', () => {
it('should rejects new instance of prohibited error', () => {
expect(commons.errors.prohibited.reject('w', 'd')).rejects.toEqual(new Prohibited('w', 'd'));
});
});
});
});