UNPKG

oa-jira

Version:

Octet Agile's JIRA connectivity project.

28 lines (25 loc) 1.03 kB
const commons = require('../../../../src/commons/'); const TooBig = require('../../../../src/commons/errors/too.big.error'); describe('Check [Too Big] class', () => { describe('Check constructor', () => { it.each([ [undefined, undefined], [2, 'stuff'], ['thing', 4] ])('should return new instance when what is [%s] and min is [%s]', (what, min) => { expect(commons.errors.too.big.new(what, min)).toBeInstanceOf(TooBig); expect(commons.errors.too.big.new(what, min).message).toEqual(`The [${what}] CANNOT be greater than ${min}.`); }); }); describe('Check static utilities.', () => { describe('Check [reject] static utility', () => { it.each([ [undefined, undefined], [2, 'stuff'], ['thing', 4] ])('should reject new instance when what is [%s] and min is [%s].', async (what, min) => { expect(commons.errors.too.big.reject(what, min)).rejects.toEqual(new TooBig(what, min)); }); }); }); });