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

Properly fix #14 and fix #24 #28

Merged
merged 2 commits into from
Mar 26, 2018

Conversation

coagmano
Copy link
Contributor

The previous fix for #14 (PR #27) had an issue where it could break tests that weren't affected by #14 before because the collections object returned from PublicationCollector will have the randomised names, where previously folks could just reference the original collection's name like so:

collector.collect('projects', collections => {
    assert.equal(collections.projects.length, 3);
    done();
});

Using the original collection name creates the issue that LocalCollectionDriver caches the contents of named collections. This PR pre-emptively removes the documents from the local collection when calling restore, so future stubbed collections won't have the old docs.

To handle the case where multiple null/unnamed collections are stubbed, this PR uses a Map to pair collections with their local collection stubs, solving #24.

@hwillson
Copy link
Owner

Make sense @coagmano, great fix - thanks very much!

@hwillson hwillson merged commit 3942277 into hwillson:master Mar 26, 2018
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

Successfully merging this pull request may close these issues.

None yet

2 participants