mirror of
https://github.com/status-im/realm-js.git
synced 2025-02-02 17:53:55 +00:00
possible fix to session tests timeout
This commit is contained in:
parent
7543c1274d
commit
c959cc799c
@ -54,9 +54,14 @@ module.exports = {
|
|||||||
const accessTokenRefreshed = this;
|
const accessTokenRefreshed = this;
|
||||||
|
|
||||||
function postTokenRefreshChecks(sender, error) {
|
function postTokenRefreshChecks(sender, error) {
|
||||||
TestCase.assertEqual(error, accessTokenRefreshed);
|
try {
|
||||||
TestCase.assertEqual(sender.url, `realm://localhost:9080/${user.identity}/myrealm`);
|
TestCase.assertEqual(error, accessTokenRefreshed);
|
||||||
resolve();
|
TestCase.assertEqual(sender.url, `realm://localhost:9080/${user.identity}/myrealm`);
|
||||||
|
resolve();
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
_reject(e)
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Let the error handler trigger our checks when the access token was refreshed.
|
// Let the error handler trigger our checks when the access token was refreshed.
|
||||||
@ -66,6 +71,7 @@ module.exports = {
|
|||||||
const realm = new Realm(config);
|
const realm = new Realm(config);
|
||||||
const session = realm.syncSession;
|
const session = realm.syncSession;
|
||||||
|
|
||||||
|
|
||||||
TestCase.assertInstanceOf(session, Realm.Sync.Session);
|
TestCase.assertInstanceOf(session, Realm.Sync.Session);
|
||||||
TestCase.assertEqual(session.user.identity, user.identity);
|
TestCase.assertEqual(session.user.identity, user.identity);
|
||||||
TestCase.assertEqual(session.config.url, config.sync.url);
|
TestCase.assertEqual(session.config.url, config.sync.url);
|
||||||
@ -73,17 +79,22 @@ module.exports = {
|
|||||||
TestCase.assertUndefined(session.url);
|
TestCase.assertUndefined(session.url);
|
||||||
TestCase.assertEqual(session.state, 'active');
|
TestCase.assertEqual(session.state, 'active');
|
||||||
});
|
});
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
testErrorHandling() {
|
testErrorHandling() {
|
||||||
return promisifiedRegister('http://localhost:9080', uuid(), 'password').then(user => {
|
return promisifiedRegister('http://localhost:9080', uuid(), 'password').then(user => {
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve, _reject) => {
|
||||||
const config = { sync: { user, url: 'realm://localhost:9080/~/myrealm' } };
|
const config = { sync: { user, url: 'realm://localhost:9080/~/myrealm' } };
|
||||||
config.sync.error = (sender, error) => {
|
config.sync.error = (sender, error) => {
|
||||||
TestCase.assertEqual(error.message, 'simulated error');
|
try {
|
||||||
TestCase.assertEqual(error.code, 123);
|
TestCase.assertEqual(error.message, 'simulated error');
|
||||||
resolve();
|
TestCase.assertEqual(error.code, 123);
|
||||||
|
resolve();
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
_reject(e);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
const realm = new Realm(config);
|
const realm = new Realm(config);
|
||||||
const session = realm.syncSession;
|
const session = realm.syncSession;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user