chore: fix flaky test (#3928)
* logOut is async so handle with a promise
This commit is contained in:
@@ -1204,29 +1204,30 @@ describe('Parse.User testing', () => {
|
|||||||
strictEqual(provider.authData.expiration_date, provider.synchronizedExpiration);
|
strictEqual(provider.authData.expiration_date, provider.synchronizedExpiration);
|
||||||
ok(model._isLinked("facebook"), "User should be linked to facebook");
|
ok(model._isLinked("facebook"), "User should be linked to facebook");
|
||||||
|
|
||||||
Parse.User.logOut();
|
Parse.User.logOut().then(() => {
|
||||||
ok(provider.loggedOut);
|
ok(provider.loggedOut);
|
||||||
provider.loggedOut = false;
|
provider.loggedOut = false;
|
||||||
|
|
||||||
Parse.User._logInWith("facebook", {
|
Parse.User._logInWith("facebook", {
|
||||||
success: function(innerModel) {
|
success: function(innerModel) {
|
||||||
ok(innerModel instanceof Parse.User,
|
ok(innerModel instanceof Parse.User,
|
||||||
"Model should be a Parse.User");
|
"Model should be a Parse.User");
|
||||||
ok(innerModel === Parse.User.current(),
|
ok(innerModel === Parse.User.current(),
|
||||||
"Returned model should be the current user");
|
"Returned model should be the current user");
|
||||||
ok(provider.authData.id === provider.synchronizedUserId);
|
ok(provider.authData.id === provider.synchronizedUserId);
|
||||||
ok(provider.authData.access_token === provider.synchronizedAuthToken);
|
ok(provider.authData.access_token === provider.synchronizedAuthToken);
|
||||||
ok(innerModel._isLinked("facebook"),
|
ok(innerModel._isLinked("facebook"),
|
||||||
"User should be linked to facebook");
|
"User should be linked to facebook");
|
||||||
ok(innerModel.existed(), "User should not be newly-created");
|
ok(innerModel.existed(), "User should not be newly-created");
|
||||||
done();
|
done();
|
||||||
},
|
},
|
||||||
error: function(model, error) {
|
error: function(model, error) {
|
||||||
jfail(error);
|
jfail(error);
|
||||||
ok(false, "LogIn should have worked");
|
ok(false, "LogIn should have worked");
|
||||||
done();
|
done();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}, done.fail);
|
||||||
},
|
},
|
||||||
error: function(model, error) {
|
error: function(model, error) {
|
||||||
jfail(error);
|
jfail(error);
|
||||||
|
|||||||
Reference in New Issue
Block a user