mirror of
https://github.com/vale981/grapher
synced 2025-03-05 09:31:42 -05:00
added test for non-existing links
This commit is contained in:
parent
d1bdae5360
commit
afe67aa254
1 changed files with 12 additions and 1 deletions
|
@ -304,7 +304,7 @@ describe('Collection Links', function () {
|
||||||
assert.isUndefined(CommentCollection.findOne(comment._id));
|
assert.isUndefined(CommentCollection.findOne(comment._id));
|
||||||
});
|
});
|
||||||
|
|
||||||
it ('Should allow actions from inversed links', function () {
|
it('Should allow actions from inversed links', function () {
|
||||||
let comment = {text: 'abc'};
|
let comment = {text: 'abc'};
|
||||||
|
|
||||||
let postId = PostCollection.insert({text: 'hello'});
|
let postId = PostCollection.insert({text: 'hello'});
|
||||||
|
@ -333,5 +333,16 @@ describe('Collection Links', function () {
|
||||||
|
|
||||||
let postMetaCategoryLink = PostCollection.getLink(insertedPostViaVirtual, 'metaCategory');
|
let postMetaCategoryLink = PostCollection.getLink(insertedPostViaVirtual, 'metaCategory');
|
||||||
assert.equal('boom!', postMetaCategoryLink.metadata().testValue);
|
assert.equal('boom!', postMetaCategoryLink.metadata().testValue);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Should fail when you try to add a non-existing link', function (done) {
|
||||||
|
let postId = PostCollection.insert({text: 'hello'});
|
||||||
|
|
||||||
|
try {
|
||||||
|
PostCollection.getLink(postId, 'comments').add('XXXXXXX');
|
||||||
|
} catch (e) {
|
||||||
|
assert.equal(e.error, 'not-found');
|
||||||
|
done();
|
||||||
|
}
|
||||||
})
|
})
|
||||||
});
|
});
|
Loading…
Add table
Reference in a new issue