Open FrederikBanke opened 1 year ago
I'm gonna set some time aside to review this soon. But as a note, I am planning on releasing a breaking version (1.0.0) where I think I'm going to make simulateQueryFilters
true by default. So the param would be disabling. My only worry is that if we don't have perfect feature parody, people may end up thinking their tests are wrong even though it's just our mock that isn't querying exactly right (which isn't important for writing tests imo).
I understand not merging, if it does not align with the purpose of the project. The reason I made the changes myself, was because I did need the queries to simulate for my own tests.
I just created the pull request in case it was of use to others.
I also understand that it can create my problems, if it doesn't work 1:1 with the real queries.
Description
I have implemented 4 methods related to the
Query
class.limit()
orderBy()
startAt()
startAfter()
They should behave more like the actual Firestore methods.
Do note, that I have not taken
simulateQueryFilters
into consideration, but it should be a quick fix, if the new functions should only run whensimulateQueryFilters
is set totrue
.Limitations
In functions where values needs to be compared, only numbers, strings and timestamps are compared.
How to test
I have added tests in
query.test.js
, that testQuery.limit()
,Query.orderBy()
,Query.startAt()
andQuery.startAfter()
.