Skip to content

Instantly share code, notes, and snippets.

@aitchkhan
Created December 8, 2017 03:38
Show Gist options
  • Save aitchkhan/db6907e9b7eea4cff57b3153871dcc44 to your computer and use it in GitHub Desktop.
Save aitchkhan/db6907e9b7eea4cff57b3153871dcc44 to your computer and use it in GitHub Desktop.
Here is a sample test written with mocha + chai + sinon
describe('Error case(s)', () => {
it('should return type required error', (done) => {
repos.favorites.contentIdsCount.resolves(contentIdsCountResponse);
expect(services.aggregates.view({skip: 0, pageSize: 15, type: 'randomType'}))
.to.eventually.be.rejected.and.be.an.instanceOf(errorHelper.BadRequestError)
.and.eventually.deep.equal(new errorHelper.BadRequestError([messages.validation.aggregateType.enum]))
.notify(done);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment