From 2e2b591d3e74ffebda0382189036b4f81818c5b0 Mon Sep 17 00:00:00 2001 From: Peter deHaan Date: Wed, 11 Dec 2013 17:46:12 -0800 Subject: [PATCH] Cleaning up some JSHint errors --- app/scripts/views/sign_in.js | 4 +++- app/scripts/views/sign_up.js | 4 +++- tests/functional.js | 4 +++- tests/functional/create_account.js | 6 ++++-- tests/functional/login.js | 4 +++- tests/intern_functional.js | 1 + tests/intern_remote.js | 2 ++ tests/tdd.js | 2 +- tests/tdd/assertion_service.js | 24 +++++++++++++----------- 9 files changed, 33 insertions(+), 18 deletions(-) diff --git a/app/scripts/views/sign_in.js b/app/scripts/views/sign_in.js index 48b508d42..62dca3856 100644 --- a/app/scripts/views/sign_in.js +++ b/app/scripts/views/sign_in.js @@ -19,7 +19,9 @@ function(BaseView, SignInTemplate, gherkin, Session, Constants) { signIn: function(event) { event.preventDefault(); - if (! (this._validateEmail() && this._validatePassword())) return; + if (! (this._validateEmail() && this._validatePassword())) { + return; + } var email = this.$('.email').val(); var password = this.$('.password').val(); diff --git a/app/scripts/views/sign_up.js b/app/scripts/views/sign_up.js index 6813286eb..23c429f4d 100644 --- a/app/scripts/views/sign_up.js +++ b/app/scripts/views/sign_up.js @@ -19,7 +19,9 @@ function(BaseView, SignUpTemplate, gherkin, Session, Constants) { signUp: function(event) { event.preventDefault(); - if (! (this._validateEmail() && this._validatePassword())) return; + if (! (this._validateEmail() && this._validatePassword())) { + return; + } var email = this.$('.email').val(); var password = this.$('.password').val(); diff --git a/tests/functional.js b/tests/functional.js index 646886744..e2476e225 100644 --- a/tests/functional.js +++ b/tests/functional.js @@ -1,4 +1,6 @@ define([ './functional/login', './functional/create_account' -], function () {}); +], function () { + 'use strict'; +}); diff --git a/tests/functional/create_account.js b/tests/functional/create_account.js index a774e309a..34174d00f 100644 --- a/tests/functional/create_account.js +++ b/tests/functional/create_account.js @@ -3,6 +3,8 @@ define([ 'intern/chai!assert', 'require' ], function (registerSuite, assert, require) { + 'use strict'; + var url = 'http://localhost:3030/flow'; //var email = 'some' + new Date().getTime() + '@example.com'; @@ -43,7 +45,7 @@ define([ .then(function (resultText) { assert.strictEqual(resultText, '', 'No errors in email creation'); }) - .end() + .end(); } }); -}); \ No newline at end of file +}); diff --git a/tests/functional/login.js b/tests/functional/login.js index f9cad68ff..9ccdfc3a2 100644 --- a/tests/functional/login.js +++ b/tests/functional/login.js @@ -3,6 +3,8 @@ define([ 'intern/chai!assert', 'require' ], function (registerSuite, assert, require) { + 'use strict'; + var url = 'http://localhost:3030/flow'; registerSuite({ @@ -43,7 +45,7 @@ define([ .then(function (text) { assert.strictEqual(text, 'Try another email or Create an account', 'Validates false login'); }) - .end() + .end(); } }); }); \ No newline at end of file diff --git a/tests/intern_functional.js b/tests/intern_functional.js index 2a33db234..e5838a563 100644 --- a/tests/intern_functional.js +++ b/tests/intern_functional.js @@ -1,6 +1,7 @@ define([ './intern' ], function (intern) { + 'use strict'; intern.suites = []; intern.functionalSuites = [ 'tests/functional' ]; diff --git a/tests/intern_remote.js b/tests/intern_remote.js index a4785bc6b..67023ef7c 100644 --- a/tests/intern_remote.js +++ b/tests/intern_remote.js @@ -1,6 +1,8 @@ define([ './intern' ], function (intern) { + 'use strict'; + // simply override the main config file and adjust it to suite the local env // disable Sauce Connect for local config diff --git a/tests/tdd.js b/tests/tdd.js index b6bb32d92..cc0ad3411 100644 --- a/tests/tdd.js +++ b/tests/tdd.js @@ -1,3 +1,3 @@ define([ './tdd/assertion_service' -], function () {}); \ No newline at end of file +], function () {}); diff --git a/tests/tdd/assertion_service.js b/tests/tdd/assertion_service.js index fa41d9723..963888b36 100644 --- a/tests/tdd/assertion_service.js +++ b/tests/tdd/assertion_service.js @@ -7,7 +7,6 @@ define([ 'intern/order!static/javascripts/vendor/bidbundle.js', 'intern/order!static/javascripts/assertion_service.js' ], function (tdd, assert, Deferred, request) { - with (tdd) { suite('assertion_service', function () { var client; @@ -30,7 +29,7 @@ define([ return client.login(); }) - .done(function (x) { + .done(function () { setupDfd.resolve(); }); @@ -98,7 +97,7 @@ define([ request .get(serverUrl + '/.well-known/browserid', { headers: { - "X-Requested-With": '' + 'X-Requested-With': '' } }) .then( @@ -128,18 +127,21 @@ define([ assert.ok(components.payload.iat, 'Issued date exists'); assert.ok(components.payload.exp, 'Expire date exists'); - if (typeof components.payload.iat !== 'number') + if (typeof components.payload.iat !== 'number') { dfd.reject(new assert.AssertionError({ message: 'cert lacks an "issued at" (.iat) field' })); + } - if (typeof components.payload.exp !== 'number') + if (typeof components.payload.exp !== 'number') { dfd.reject(new assert.AssertionError({ message: 'cert lacks an "expires" (.exp) field' })); + } - if (components.payload.exp < components.payload.iat) + if (components.payload.exp < components.payload.iat) { dfd.reject(new assert.AssertionError({ message: 'assertion expires before cert is valid' })); + } - if (components.payload.exp > (components.payload.exp + 5000)) + if (components.payload.exp > (components.payload.exp + 5000)) { dfd.reject(new assert.AssertionError({ message: 'assertion was likely issued after cert expired' })); - + } return { assertion: assertion, @@ -152,7 +154,7 @@ define([ }, function (err) { dfd.reject(); - assert.fail(err, null, '.well-known request failed') + assert.fail(err, null, '.well-known request failed'); } ) .then( @@ -177,7 +179,7 @@ define([ } ); - return verifyDeferred.promise + return verifyDeferred.promise; } ) .then( @@ -205,7 +207,7 @@ define([ } }); - return verifyBundleDeferred.promise + return verifyBundleDeferred.promise; } ).otherwise(function (error) { dfd.reject(error); });