katowulf / mockfirebase

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

Basic tutorial doesn't work out of the box #66

Closed Grety closed 9 years ago

Grety commented 9 years ago

MockFirebase.override() doesn't seem to exist

katowulf commented 9 years ago

Not enough detail here to repro issue. It clearly exists.

bendrucker commented 9 years ago

There are even smoke tests against it:

https://github.com/katowulf/mockfirebase/blob/master/test/smoke/globals.js

It's only in the browser build.

Grety commented 9 years ago

Am I getting something wrong? the tutorial clearly states: npm install MockFirebase var MockFirebase = require('MockFirebase').MockFirebase; However MockFirebase.override() is not accessible. I'm using it from Node.js 0.10.35

katowulf commented 9 years ago

Once again, not enough detail. What tutorial? Where? I've looked through everything in tutorials/ and the readme and not found any instructions stating that you should do npm install followed by a require followed by an override.

I did find this in the tutorials, however, which is linked in the readme, and explains that override() is for Firebase on the window object, which would preclude usage in node.

Please provide enough detail so we can understand what you're driving at here and determine if there is something to fix.

Grety commented 9 years ago

Although, as you mentioned, it can be inferred from the reading more docs that it replaces window.Firebase, and thus cannot be used in Node.js, this Basics Tutorial doesn't show this evidently. And a tutorial exists for stating basic things. So I still insist that it this .md file that should be corrected. I was on that page in 45 seconds after I learned about MockFirebase's existence but it took me about half an hour to sort things out with .override() because 'Basics Tutorial' doesn't actually contain basics. This tutorial works fine in Node.js too with the exclusion of .override() call, so why not just describe the matter for those who might need it and ease the learning curve?

bendrucker commented 9 years ago

https://github.com/katowulf/mockfirebase/blob/master/tutorials/proxyquire.md

katowulf commented 9 years ago

Thanks for the link, that certainly clarifies things a bit. So you read through the Basics Tutorial under the assumption that it applied to node.js. Appreciate both the feedback and the time you took to report the issue. Hopefully Ben's fix will help others from running into the same confusion. Cheers.

Grety commented 9 years ago

Thanks for update! Looks like project is alive and the team reacts in a timely fashion! I will continue to post more as long as I encounter. I've got a couple of more serious issues already