UNPKG

oa-jira

Version:

Octet Agile's JIRA connectivity project.

24 lines (19 loc) 816 B
const commons = require('../../../../src/commons'); describe('Check [promise] utilities', () => { const fnHelloWorld = () => `Hello World`; const fnAdd = (int1, int2) => int1 + int2; const fnThrow = msg => { throw new Error(msg); }; describe('Check [async] utility', () => { it('should resolve [4] when given 1 and 3 to "add" function.', () => { expect(commons.promise.async(fnAdd, 1, 3)).resolves.toEqual(4); }); it('should resolve [Hello World] when call "hello world" function.', () => { expect(commons.promise.async(fnHelloWorld)).resolves.toEqual(`Hello World`); }); it('should reject [Aïe] when call "throw" function with "Aïe".', () => { expect(commons.promise.async(fnThrow, 'Aïe')).rejects.toThrow(`Aïe`); }); }); });