Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any second stubbed collection does not clean up #24

Closed
bvanderdrift opened this issue Dec 4, 2017 · 0 comments
Closed

Any second stubbed collection does not clean up #24

bvanderdrift opened this issue Dec 4, 2017 · 0 comments

Comments

@bvanderdrift
Copy link

bvanderdrift commented Dec 4, 2017

I am writing tests with two collections which are client-side only. When calling restore and stub again after inserting, the first collection that was stubbed will be emptied, while the second will not. Please see this snippet:

let Collection1 = new Mongo.Collection(null);
let Collection2 = new Mongo.Collection(null);

StubCollections.stub([Collection1, Collection2]);

Collection1.insert({a: "a"});
Collection2.insert({b: "b"});

StubCollections.restore();

StubCollections.stub([Collection1, Collection2]);

Collection1.insert({c: "c"});
Collection2.insert({d: "d"});

console.log(Collection1.find().fetch()); //[{c: "c"}]
console.log(Collection2.find().fetch()); //[{b: "b", d: "d"}]

Same happens when using

StubCollections.stub(Collection1);
StubCollections.stub(Collection2);

seperatly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant