UNPKG

assertsjs

Version:

ECMA6 Module for Javascript type validations

22 lines (18 loc) 652 B
jest.unmock('./../../src/Asserts'); describe('Asserts.assert tests', () => { it('Asserts.assert should return the value', () => { const Asserts = require('./../../src/Asserts'); const bool = true; expect(bool).toBe(Asserts.assert(bool)); }); it('Asserts.assert should return an error', () => { const Asserts = require('./../../src/Asserts'); const bool = false; const expectedMessageError = 'Assertion error'; try { Asserts.assert(bool); } catch (error) { expect(expectedMessageError).toBe(error.message); } }); });