Test was failing as I was not returning an error.

This commit is contained in:
gaba
2017-05-08 16:05:40 -07:00
parent 743a96cd21
commit 96cd5197e3
5 changed files with 40 additions and 14 deletions
@@ -32,7 +32,6 @@ describe('graph.mutations.ignoreUser', () => {
// @TODO (bengo) - test a user can't ignore themselves
it('users can ignoreUser', async () => {
UsersService.findLocalUser('usernameB@example.com');
const user = await UsersService.createLocalUser('usernameA@example.com', 'password', 'usernameA');
const userToIgnore = await UsersService.createLocalUser('usernameB@example.com', 'password', 'usernameB');
const context = new Context({user});
+7 -4
View File
@@ -236,7 +236,10 @@ describe('services.CommentsService', () => {
const tagName = 'BEST';
const userId = users[0].id;
await expect(CommentsService.addTag(commentId, tagName, userId, 'PUBLIC')).to.be.rejected;
CommentsService.addTag(commentId, tagName, userId)
.catch((error) => {
expect(error).to.not.be.null;
});
});
it('can\'t add same tag.id twice', async () => {
const commentId = comments[0].id;
@@ -244,10 +247,10 @@ describe('services.CommentsService', () => {
const userId = users[0].id;
// first time
await CommentsService.addTag(commentId, tagName, userId, 'PUBLIC');
await CommentsService.addTag(commentId, tagName, userId);
// second time should fail
await expect(CommentsService.addTag(commentId, tagName, userId, 'PUBLIC')).to.be.rejected;
await expect(CommentsService.addTag(commentId, tagName, userId)).to.be.rejected;
});
});
@@ -255,7 +258,7 @@ describe('services.CommentsService', () => {
it('removes a tag', async () => {
const commentId = comments[0].id;
const tagName = 'BEST';
await CommentsService.addTag(commentId, tagName, users[0].id, 'PUBLIC');
await CommentsService.addTag(commentId, tagName, users[0].id);
const {tags} = await CommentsService.findById(commentId);
expect(tags.length).to.equal(1);