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

fix tests not completing on failure #961

Merged
merged 3 commits into from Apr 6, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/js/index.js
Expand Up @@ -80,7 +80,7 @@ exports.runTest = function(suiteName, testName) {
if (testMethod) {
// Start fresh in case of a crash in a previous run.
Realm.clearTestState();

console.log("Starting test " + testName);
var promise;
try {
promise = testMethod.call(testSuite);
Expand Down
12 changes: 3 additions & 9 deletions tests/js/user-tests.js
Expand Up @@ -162,10 +162,9 @@ module.exports = {
},

testLogin() {
return new Promise((resolve, _reject) => {
var username = uuid();
// Create user, logout the new user, then login
callbackTest((callback) => Realm.Sync.User.register('http://localhost:9080', username, 'password', callback), (error, user) => {
return callbackTest((callback) => Realm.Sync.User.register('http://localhost:9080', username, 'password', callback), (error, user) => {
failOnError(error);
user.logout();

Expand All @@ -180,7 +179,6 @@ module.exports = {
resolve();
});
});
});
},

testLoginMissingUsername() {
Expand Down Expand Up @@ -226,12 +224,11 @@ module.exports = {
},

testAll() {
return new Promise((resolve, _reject) => {
let all;
all = Realm.Sync.User.all;
TestCase.assertArrayLength(Object.keys(all), 0);

callbackTest((callback) => Realm.Sync.User.register('http://localhost:9080', uuid(), 'password', callback), (error, user1) => {
return callbackTest((callback) => Realm.Sync.User.register('http://localhost:9080', uuid(), 'password', callback), (error, user1) => {
failOnError(error);

all = Realm.Sync.User.all;
Expand Down Expand Up @@ -259,14 +256,12 @@ module.exports = {
resolve();
});
});
});
},

testCurrent() {
return new Promise((resolve, _reject) => {
TestCase.assertUndefined(Realm.Sync.User.current);

callbackTest((callback) => Realm.Sync.User.register('http://localhost:9080', uuid(), 'password', callback), (error, user1) => {
return callbackTest((callback) => Realm.Sync.User.register('http://localhost:9080', uuid(), 'password', callback), (error, user1) => {
failOnError(error);
assertIsSameUser(Realm.Sync.User.current, user1);

Expand All @@ -283,7 +278,6 @@ module.exports = {
resolve();
});
});
});
},

testManagementRealm() {
Expand Down