Skip to content
This repository has been archived by the owner on Apr 3, 2019. It is now read-only.

Commit

Permalink
style(lib): update let to const when possible
Browse files Browse the repository at this point in the history
#1652

r=philbooth
  • Loading branch information
seanmonstar authored and philbooth committed Feb 10, 2017
1 parent 9c23b0a commit 29c9f39
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 23 deletions.
6 changes: 3 additions & 3 deletions lib/routes/account.js
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ module.exports = function (
function checkIsBlockForced () {
// For testing purposes, some email addresses are forced
// to go through signin unblock on every login attempt.
let forced = config.signinUnblock && config.signinUnblock.enabled && config.signinUnblock.forcedEmailAddresses
const forced = config.signinUnblock && config.signinUnblock.enabled && config.signinUnblock.forcedEmailAddresses

if (forced && forced.test(email)) {
return P.reject(error.requestBlocked(true))
Expand Down Expand Up @@ -764,7 +764,7 @@ module.exports = function (
}
})
.then(() => {
let sessionTokenOptions = {
const sessionTokenOptions = {
uid: emailRecord.uid,
email: emailRecord.email,
emailCode: emailRecord.emailCode,
Expand Down Expand Up @@ -1671,7 +1671,7 @@ module.exports = function (
)
.then(
(account) => {
let isAccountVerification = butil.buffersAreEqual(code, account.emailCode)
const isAccountVerification = butil.buffersAreEqual(code, account.emailCode)

/**
* Logic for account and token verification
Expand Down
2 changes: 1 addition & 1 deletion lib/routes/password.js
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ module.exports = function (
})
.then(maybeToken => {
// Create a sessionToken with the verification status of the current session
let sessionTokenOptions = {
const sessionTokenOptions = {
uid: account.uid,
email: account.email,
emailCode: account.emailCode,
Expand Down
2 changes: 1 addition & 1 deletion npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions test/local/lib/log.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ describe('log', () => {
log.activityEvent()

assert.equal(logger.error.callCount, 1, 'logger.error was called once')
let args = logger.error.args[0]
const args = logger.error.args[0]
assert.equal(args.length, 2, 'logger.error was passed two arguments')
assert.equal(args[0], 'log.activityEvent', 'first argument was function name')
assert.deepEqual(args[1], {
Expand All @@ -137,7 +137,7 @@ describe('log', () => {
})

assert.equal(logger.error.callCount, 1, 'logger.error was called once')
let args = logger.error.args[0]
const args = logger.error.args[0]
assert.equal(args.length, 2, 'logger.error was passed two arguments')
assert.equal(args[0], 'log.activityEvent', 'first argument was function name')
assert.deepEqual(args[1], {
Expand Down Expand Up @@ -165,7 +165,7 @@ describe('log', () => {
})

assert.equal(logger.error.callCount, 1, 'logger.error was called once')
let args = logger.error.args[0]
const args = logger.error.args[0]
assert.equal(args.length, 2, 'logger.error was passed two arguments')
assert.equal(args[0], 'log.activityEvent', 'first argument was function name')
assert.deepEqual(args[1], {
Expand Down Expand Up @@ -222,7 +222,7 @@ describe('log', () => {
log.flowEvent()

assert.equal(logger.error.callCount, 1, 'logger.error was called once')
let args = logger.error.args[0]
const args = logger.error.args[0]
assert.equal(args.length, 2, 'logger.error was passed two arguments')
assert.equal(args[0], 'log.flowEvent', 'first argument was function name')
assert.deepEqual(args[1], {
Expand Down Expand Up @@ -250,7 +250,7 @@ describe('log', () => {
})

assert.equal(logger.error.callCount, 1, 'logger.error was called once')
let args = logger.error.args[0]
const args = logger.error.args[0]
assert.equal(args.length, 2, 'logger.error was passed two arguments')
assert.equal(args[0], 'log.flowEvent', 'first argument was function name')
assert.deepEqual(args[1], {
Expand Down Expand Up @@ -282,7 +282,7 @@ describe('log', () => {
})

assert.equal(logger.error.callCount, 1, 'logger.error was called once')
let args = logger.error.args[0]
const args = logger.error.args[0]
assert.equal(args.length, 2, 'logger.error was passed two arguments')
assert.equal(args[0], 'log.flowEvent', 'first argument was function name')
assert.deepEqual(args[1], {
Expand Down Expand Up @@ -314,7 +314,7 @@ describe('log', () => {
})

assert.equal(logger.error.callCount, 1, 'logger.error was called once')
let args = logger.error.args[0]
const args = logger.error.args[0]
assert.equal(args.length, 2, 'logger.error was passed two arguments')
assert.equal(args[0], 'log.flowEvent', 'first argument was function name')
assert.deepEqual(args[1], {
Expand Down Expand Up @@ -346,7 +346,7 @@ describe('log', () => {
})

assert.equal(logger.error.callCount, 1, 'logger.error was called once')
let args = logger.error.args[0]
const args = logger.error.args[0]
assert.equal(args.length, 2, 'logger.error was passed two arguments')
assert.equal(args[0], 'log.flowEvent', 'first argument was function name')
assert.deepEqual(args[1], {
Expand Down
6 changes: 3 additions & 3 deletions test/local/lib/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ describe('lib/server', () => {
})

describe('logEndpointErrors', () => {
let msg = 'Timeout'
let reason = 'Socket fail'
let response = {
const msg = 'Timeout'
const reason = 'Socket fail'
const response = {
__proto__: {
name: 'EndpointError'
},
Expand Down
12 changes: 6 additions & 6 deletions test/local/pool.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ describe('Pool', () => {
'pool.request callback with error',
() => {
var pool = new Pool('http://example.com/')
let p = pool.request()
const p = pool.request()
.then(function () {
assert(false, 'request should have failed')
}, function (error) {
Expand All @@ -96,7 +96,7 @@ describe('Pool', () => {
'pool.request callback with HTTP error response',
() => {
var pool = new Pool('http://example.com/')
let p = pool.request()
const p = pool.request()
.then(function () {
assert(false, 'request should have failed')
}, function (error) {
Expand All @@ -116,7 +116,7 @@ describe('Pool', () => {
'pool.request callback with HTTP error response and JSON body',
() => {
var pool = new Pool('http://example.com/')
let p = pool.request()
const p = pool.request()
.then(function () {
assert(false, 'request should have failed')
}, function (error) {
Expand All @@ -137,7 +137,7 @@ describe('Pool', () => {
'pool.request callback with HTTP success response and empty body',
() => {
var pool = new Pool('http://example.com/')
let p = pool.request()
const p = pool.request()
.then(function (result) {
assert.equal(result, undefined, 'result is undefined')
})
Expand All @@ -153,7 +153,7 @@ describe('Pool', () => {
'pool.request callback with HTTP success response and valid JSON body',
() => {
var pool = new Pool('http://example.com/')
let p = pool.request()
const p = pool.request()
.then(function (result) {
assert.equal(typeof result, 'object', 'result is object')
assert.equal(Object.keys(result).length, 1, 'result has 1 property')
Expand All @@ -171,7 +171,7 @@ describe('Pool', () => {
'pool.request callback with HTTP success response and invalid JSON body',
() => {
var pool = new Pool('http://example.com/')
let p = pool.request()
const p = pool.request()
.then(function () {
assert(false, 'request should have failed')
}, function (error) {
Expand Down
2 changes: 1 addition & 1 deletion test/test_server.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ TestServer.prototype.stop = function () {
currentServer = undefined
try { this.db.close() } catch (e) {}
if (this.server) {
let doomed = [
const doomed = [
processKill(this.server, 'server', 'SIGINT'),
processKill(this.mail, 'mail')
]
Expand Down

0 comments on commit 29c9f39

Please sign in to comment.