Skip to content

Commit 73aafa2

Browse files
authored
fix(tests): Stabilize flaky tests (#3876)
* Longer TTL, shorter wait * Makes sure we wait for the logout - Parse.User.logOut is async and was making a test flaky
1 parent 57efd89 commit 73aafa2

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

spec/InMemoryCache.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const InMemoryCache = require('../src/Adapters/Cache/InMemoryCache').default;
33

44
describe('InMemoryCache', function() {
55
var BASE_TTL = {
6-
ttl: 10
6+
ttl: 100
77
};
88
var NO_EXPIRE_TTL = {
99
ttl: NaN
@@ -28,7 +28,7 @@ describe('InMemoryCache', function() {
2828
var value = cache.get(KEY);
2929
expect(value).toEqual(VALUE);
3030

31-
wait(BASE_TTL.ttl * 5).then(() => {
31+
wait(BASE_TTL.ttl * 2).then(() => {
3232
value = cache.get(KEY)
3333
expect(value).toEqual(null);
3434
done();

spec/ParseUser.spec.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1271,20 +1271,20 @@ describe('Parse.User testing', () => {
12711271
Parse.User._registerAuthenticationProvider(provider);
12721272
Parse.User._logInWith("facebook", {
12731273
success: function() {
1274-
Parse.User.logOut();
1275-
1276-
Parse.Cloud.beforeSave(Parse.User, function(req, res) {
1277-
res.error("Before save shouldn't be called on login");
1278-
});
1274+
Parse.User.logOut().then(() => {
1275+
Parse.Cloud.beforeSave(Parse.User, function(req, res) {
1276+
res.error("Before save shouldn't be called on login");
1277+
});
12791278

1280-
Parse.User._logInWith("facebook", {
1281-
success: function() {
1282-
done();
1283-
},
1284-
error: function(model, error) {
1285-
ok(undefined, error);
1286-
done();
1287-
}
1279+
Parse.User._logInWith("facebook", {
1280+
success: function() {
1281+
done();
1282+
},
1283+
error: function(model, error) {
1284+
ok(undefined, error);
1285+
done();
1286+
}
1287+
});
12881288
});
12891289
}
12901290
});

0 commit comments

Comments
 (0)