Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support onDisconnect() #62

Open
allannaranjo opened this issue Jan 22, 2015 · 2 comments
Open

Support onDisconnect() #62

allannaranjo opened this issue Jan 22, 2015 · 2 comments

Comments

@allannaranjo
Copy link

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;
@bendrucker bendrucker changed the title Calling onDisconnect() on presence is undefined Support onDisconnect() Jan 22, 2015
@bendrucker bendrucker assigned bendrucker and unassigned bendrucker Jan 22, 2015
@bendrucker
Copy link
Collaborator

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.

@katowulf
Copy link
Owner

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...
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants