mockfirebase
mockfirebase copied to clipboard
Support onDisconnect()
Looking at firebase.js and mockfirebase.js I see that the onDisconnect method is not implemented. This is causing our test to fail.
See firebase onDisconnect:
E.prototype.ia = function() {
return new $(this.m, this.path, this.name())
};
E.prototype.onDisconnect = E.prototype.ia;
That's correct. Right now you can just mutate MockFirebase.prototype so that ref.onDisconnect is an identity/noop. Otherwise online/offline support is on my list.
So, for example, my test units have some items like this (which I use to mock the new 2.0 methods):
var _ = require('lodash');
// _.noop is essentially just an empty function
_.extend(MockFirebase.prototype, {
onDisconnect: _.noop,
authWithOAuthPassword: _.noop,
limitToFirst: jasmine.createSpy('limitToFirst'),
// and so on...
});