Lint cleanup for tests

This commit is contained in:
Ian Gulliver
2014-05-28 21:56:12 -07:00
parent d5941a49f7
commit 76bd05d03d
2 changed files with 24 additions and 16 deletions

View File

@@ -185,7 +185,7 @@ asyncTest('Duplicate message suppression', function() {
var message2 = randstring();
var callbacks = {
'onMessage': function (msg) {
'onMessage': function(msg) {
equal(msg['subject']['name'], subject, 'subject matches');
equal(msg['message'], message1, 'message matches');
cosmo.shutdown();
@@ -240,8 +240,8 @@ test('getMessages/subscribe', function() {
var cosmo = new Cosmopolite({}, null, randstring());
throws(
cosmo.getMessages.bind(undefined, subject),
'getMessages before subscribe fails');
cosmo.getMessages.bind(undefined, subject),
'getMessages before subscribe fails');
cosmo.subscribe(subject);
// Verify that we can call getMessages immediately after subscribe
cosmo.getMessages(subject);
@@ -263,9 +263,12 @@ asyncTest('subscribe barrier', function() {
// We are validating that the message event generated by the subscribe
// call has already been processed by the time this promise fires
equal(cosmo.getMessages(subject).length, 1, 'one message');
equal(cosmo.getMessages(subject)[0]['subject']['name'], subject, 'subject matches');
equal(cosmo.getMessages(subject)[0]['message'], message, 'message matches');
deepEqual(cosmo.getMessages(subject)[0], cosmo.getLastMessage(subject), 'getLastMessage works');
equal(cosmo.getMessages(subject)[0]['subject']['name'], subject,
'subject matches');
equal(cosmo.getMessages(subject)[0]['message'], message,
'message matches');
deepEqual(cosmo.getMessages(subject)[0], cosmo.getLastMessage(subject),
'getLastMessage works');
cosmo.shutdown();
start();
});
@@ -299,7 +302,7 @@ asyncTest('Message ordering', function() {
expect(3);
var subject = randstring();
var messages = [ 'A', 'B', 'C', 'D' ];
var messages = ['A', 'B', 'C', 'D'];
var cosmo = new Cosmopolite({}, null, randstring());
@@ -365,13 +368,13 @@ asyncTest('subscribe ACL', function() {
var cosmo = new Cosmopolite({}, null, randstring());
cosmo.getProfile().then(function(profile) {
cosmo.subscribe({
'name': subject,
'name': subject,
'readable_only_by': profile,
}).then(function() {
ok(true, 'correct ACL succeeds');
cosmo.subscribe({
'name': subject,
'name': subject,
'readable_only_by': tempProfile,
}).then(null, function() {
ok(true, 'bad ACL fails');
@@ -399,13 +402,13 @@ asyncTest('sendMessage ACL', function() {
var cosmo = new Cosmopolite({}, null, randstring());
cosmo.getProfile().then(function(profile) {
cosmo.sendMessage({
'name': subject,
'name': subject,
'writable_only_by': profile,
}, message).then(function() {
ok(true, 'correct ACL succeeds');
cosmo.sendMessage({
'name': subject,
'name': subject,
'writable_only_by': tempProfile,
}, message).then(null, function() {
ok(true, 'bad ACL fails');
@@ -440,7 +443,7 @@ asyncTest('pin/unpin', function() {
cosmo.shutdown();
start();
},
}
};
var cosmo = new Cosmopolite(callbacks, null, randstring());
cosmo.subscribe(subject);
@@ -471,7 +474,7 @@ asyncTest('Repin', function() {
equal(subject, e['subject']['name'], 'onUnpin: subject matches');
equal(message, e['message'], 'onUnpin: message matches');
},
}
};
var cosmo = new Cosmopolite(callbacks, null, randstring());
cosmo.subscribe(subject);
@@ -505,7 +508,7 @@ asyncTest('Duplicate subject', function() {
start();
}
},
}
};
var cosmo = new Cosmopolite(callbacks, null, randstring());
});
@@ -524,7 +527,9 @@ asyncTest('Login', function() {
ok(true, 'onLogout fired');
anonymousProfile = cosmo.currentProfile();
// Entirely magic URL that sets the login cookie and redirects.
window.open('/_ah/login?email=test%40example.com&action=Login&continue=/cosmopolite/static/login_complete.html');
window.open(
'/_ah/login?email=test%40example.com&action=Login' +
'&continue=/cosmopolite/static/login_complete.html');
},
'onLogin': function(login_url) {
ok(true, 'onLogin fired');
@@ -559,7 +564,9 @@ asyncTest('Profile merge', function() {
if (messages == 1) {
cosmo.unsubscribe(subject);
// Entirely magic URL that sets the login cookie and redirects.
window.open('/_ah/login?email=test%40example.com&action=Login&continue=/cosmopolite/static/login_complete.html');
window.open(
'/_ah/login?email=test%40example.com&action=Login' +
'&continue=/cosmopolite/static/login_complete.html');
}
if (messages == 2) {
cosmo.shutdown();

View File

@@ -14,3 +14,4 @@ curl \
echo
gjslint --strict --disable=0121,0233 cosmopolite.js
gjslint --strict --disable=0121,0233 --nojsdoc test.js