UNPKG

oa-jira

Version:

Octet Agile's JIRA connectivity project.

28 lines (25 loc) 1.04 kB
const commons = require('../../../../src/commons/'); const TooSmall = require('../../../../src/commons/errors/too.small.error'); describe('Check [Too Small] 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.small.new(what, min)).toBeInstanceOf(TooSmall); expect(commons.errors.too.small.new(what, min).message).toEqual(`The [${what}] CANNOT be smaller 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.small.reject(what, min)).rejects.toEqual(new TooSmall(what, min)); }); }); }); });