Closed justjake closed 5 years ago
I think the failing tests are failing on master, too, so that's not a regression.
Hey Jake, this looks very good, thanks for the PR! This is very good feature to add, I will review and merge when I have a bit more time, probably next week.
As for the tests failing, that's correct, there is one new test added that exposes an issue that a user witnessed. I'll probably disable that test for now until the actual problem gets fixed.
cheers, Hein
Hey man, sorry for not getting around to merge this just yet. I'm planning to do this tomorrow, I'll let you know in case I have any questions. Cheers, Hein
Don’t feel any pressure to merge this yet! I haven’t added unit tests to my branch or used it in my project yet – plus it’s the holidays. Take it easy :)
I’ll ping you again when I think it’s ready to merge.
Alright cool, just let me know :) Happy Holidays dude
@IjzerenHein I haven't tested context moving from a Collection to its Documents, but I've been running this code on my site for a bit and it seems solid.
Sweet, I'll have a closer look at it shortly!
Hi, it's taken too long, but I've finally merged this PR and released a new version. Thanks for this contribution Jake. cheers, Hein
This PR adds a
context: IContext
option to the constructors of Document and Collection. An object's context contains references to its Firebase app and Firestore instance, which will be used instead of the global references ininit.ts
. Collections propagate context to their child documents.This allows consumers to use Firestorter with multiple Firebase apps, which is especially helpful when writing tests using the '@firebase/testing' module.
No changes are needed to existing code: if
context
is undefined on a Document or Collection, the global context will be used instead.I haven't added tests for the new
context
option yet: I first wanted to ask for feedback on this approach. Does this seem like a useful feature, @IjzerenHein?I'm hoping to test my Firestorter code against the Firestore simulator following this testing pattern