Last active
August 29, 2015 14:19
-
-
Save sanketmaru/7a20ab8881710724f710 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// test for resolve | |
it('Should set isValid flag when user is not member of organization', function(done) { | |
var param = { | |
username: "sanketteam", | |
userId: 42808, | |
switchedOrgId: 7607 //[email protected] | |
} | |
var promise = usermanagement.checkOrganization(param); // returns a promise and uses the service code to return it | |
// this will be in case of resolve | |
expect(promise).to.eventually.be.fulfilled.then(function (res) { // when the promise gets resolved | |
res.message.should.equal(UI_MESSAGE.USER_REMOVE); | |
}).should.notify(done); | |
}); | |
// test for reject | |
it('Should reject promise if organization is not available', function(done) { | |
var param = { | |
username: "sanketteam", | |
userId: 42808, | |
switchedOrgId: 404 //[email protected] | |
}; | |
var promise = usermanagement.checkOrganization(param); // checkOrganization is method in service which resolve/reject according to the params passed | |
// this will be in case of reject | |
expect(promise).to.eventually.be.rejected.and.should.notify(done); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment