chai expect function to throw code example
Example 1: mocha should throw error
describe('createMap', () => {
it('should throw an error if no contents were sent as argument', () => {
expect(() => createMap()).to.throw('You have to send a list of things to map.');
});
});
Example 2: chai expect to be type array
expect([1, 2]).to.be.an('array');