UNPKG

assertsjs

Version:

ECMA6 Module for Javascript type validations

22 lines (18 loc) 715 B
jest.unmock('./../../src/Asserts'); describe('Asserts.assert tests', () => { it('Asserts.assert should return the value', () => { const Asserts = require('./../../src/Asserts'); const aString = 'String!'; expect(aString).toBe(Asserts.assertString(aString)); }); it('Asserts.assert should return an error', () => { const Asserts = require('./../../src/Asserts'); const notAString = false; const expectedMessageError = 'Assertion error: string must be provided'; try { Asserts.assertString(notAString); } catch (error) { expect(expectedMessageError).toBe(error.message); } }); });