-
Notifications
You must be signed in to change notification settings - Fork 90
Initial attempt at supporting Firebase 3.x #51
Conversation
- Currently 27 passing, 10 failing tests. - Expanded stubbing required to trick Firebase 3.x into connecting locally without any network calls.
Quick update: It turns out mocking is actually not necessary for |
42 passing tests, 9 failing
Alright, only four failing tests left. These will be tricky, because they concern testing the client authentication features (using generated "custom tokens"). When the Firebase seems to determine at runtime which "version" of itself to use - either the Browser or the Server implementation of the Firebase client. This creates an interesting problem - when running in the browser, your code consuming Firebase will have access to a completely different API than it will have access to while running mocha tests in NodeJS. |
Looks promising, thanks! |
Well I guess this PR was getting a bit stale. I've been poking around trying to improve all this but haven't made much progress. I'll open a new PR for some cleanup. |
Thank you @nfarina , I am working on finishing it as we speak. We still have 4 tests fail since there is no authentication API on the server side. I will commit my progress so far in a few minutes |
yes, I just figured that one myself now :) Regarding |
It's not mocked in |
Well of course now I can't repro that problem. Perhaps |
Alright I'm wrong! |
That's superb! I am about to finishing fixing tests, committing soon and aiming for 0.6.0 release today, with Firebase 3 support :-) |
Awesome. Oh, and in regards to the |
Seems like we tests are passing now, hooray! |
Wow, your mocking method is so much cleaner! Looks awesome and seems to work great. |
Thank you :) It took a few hours of experimentation to get there though... |
Released as 0.6.0. Thank you again for all your contribution to this release! |
See #50.
Opening this PR early for feedback. This is not ready to merge!
The new Firebase client, besides having a different API structure, is hardcoded to authenticate with google.com using a service account. To skip this process requires some extensive mocking, which you'll see in
server.spec.js
. Additionally, I could not get any mocks to work without the@global
option whichproxyquire
strongly discourages.But it works well enough for most of the tests to pass.
With this level of mocking, I think "copy and paste this mocking code into your tests" is probably too onerous for the user, so I would recommend moving this code into
firebase-server
proper for the user to activate with one command.Checklist of what is remaining:
@global
require override.Open to any and all feedback on this! This has become quite a project and I will probably need some help to finish it.