katowulf / mockfirebase

Firebase mock library for writing unit tests (experimental)
157 stars 40 forks source link

Firebase 2.0 queries #39

Closed bendrucker closed 3 years ago

jamestalmage commented 9 years ago

@bendrucker How close are you on this? Can I help?

Looking at this I'm guessing you will need three comparators:

  1. orderByKey
  2. orderByPriority
  3. orderByChild(child) - generates a comparator for that specific child

The comparators are non trivial. I'm counting at least a dozen test cases for the orderByChild comparator. Would you be interested in a PR with implementations of these comparators?

I'm thinking the comparators should take references to two Snapshots. This gives the comparators access to key and priority as required. Standard comparator return values: negative number for less than, zero for equal, and positive for greater than. Make sense?

bendrucker commented 9 years ago

Basically no progress. The internals of all of the change propagation and query stuff is extremely complex with a bunch of methods highly coupled together.

Would love a PR no matter how small. I'm still debating whether these additions merit a full rewrite of the internals or whether we can get by hacking them on as is.

jamestalmage commented 9 years ago

See #61.