Skip to content

Commit

Permalink
fix snapshot.forEach() in MockFirebase, clean up old mock file
Browse files Browse the repository at this point in the history
  • Loading branch information
katowulf committed Mar 19, 2014
1 parent 23e0f07 commit 640abe2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 25 deletions.
20 changes: 0 additions & 20 deletions tests/firebase-mock.js

This file was deleted.

13 changes: 8 additions & 5 deletions tests/lib/MockFirebase.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// some hoop jumping for node require() vs browser usage
var exports = typeof exports != 'undefined' ? exports : this;
var _, sinon;
exports.Firebase = MockFirebase; //todo use MockFirebase.stub() instead of forcing overwrite
exports.Firebase = MockFirebase; //todo use MockFirebase.stub() instead of forcing overwrite of window.Firebase
if( typeof module !== "undefined" && module.exports && typeof(require) === 'function' ) {
_ = require('lodash');
sinon = require('sinon');
Expand All @@ -19,7 +19,9 @@
* ## Setup
*
* // in windows
* MockFirebase.stub(window, 'Firebase'); // replace window.Firebase
* <script src="lib/lodash.js"></script> <!-- dependency -->
* <script src="lib/MockFirebase.js"></script> <!-- the lib -->
* <!-- not working yet: MockFirebase.stub(window, 'Firebase'); // replace window.Firebase -->
*
* // in node.js
* var Firebase = require('../lib/MockFirebase');
Expand All @@ -42,8 +44,8 @@
* ## Trigger events automagically instead of calling flush()
*
* var fb = new MockFirebase('Mock://hello/world');
* fb.autoFlush(1000); // triggers events after 1 second
* fb.autoFlush(); // triggers events immediately
* fb.autoFlush(1000); // triggers events after 1 second (asynchronous)
* fb.autoFlush(); // triggers events immediately (synchronous)
*
* ## Simulating Errors
*
Expand Down Expand Up @@ -281,6 +283,7 @@
* @param {Function} [callback]
*/
auth: function(token, callback) {
//todo invoke callback with the parsed token contents
callback && this._defer(callback);
},

Expand Down Expand Up @@ -375,7 +378,7 @@
getPriority: function() { return null; }, //todo
forEach: function(cb, scope) {
_.each(data, function(v, k, list) {
var res = cb.call(scope, v, k, list);
var res = cb.call(scope, makeSnap(ref.child(k), v));
return !(res === true);
});
}
Expand Down

0 comments on commit 640abe2

Please sign in to comment.