Skip to content

Commit

Permalink
chore(cli): properly spell authentication in code (#78)
Browse files Browse the repository at this point in the history
  • Loading branch information
rajkumaar23 authored Aug 8, 2020
1 parent 6db4833 commit 9a1eb28
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
24 changes: 12 additions & 12 deletions __tests__/Utils.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,37 +84,37 @@ describe('Utils', () => {
expect(Utils.hasDevice(argv)).toEqual(true)
})

test('hasAutentication & parseAutentication with none flag', async () => {
test('hasAuthentication & parseAuthentication with no flag', async () => {
const argv = {}
expect(Utils.parseAutentication(argv)).toEqual({})
expect(Utils.hasAutentication(argv)).toEqual(false)
expect(Utils.parseAuthentication(argv)).toEqual({})
expect(Utils.hasAuthentication(argv)).toEqual(false)
})

test('hasAutentication & parseAutentication with cookie flag', async () => {
test('hasAuthentication & parseAuthentication with cookie flag', async () => {
const argv = { cookie: 'This is the COOKIE content' }
expect(Utils.parseAutentication(argv)).toEqual({
expect(Utils.parseAuthentication(argv)).toEqual({
Cookie: 'This is the COOKIE content'
})
expect(Utils.hasAutentication(argv)).toEqual(true)
expect(Utils.hasAuthentication(argv)).toEqual(true)
})

test('hasAutentication & parseAutentication with token flag', async () => {
test('hasAuthentication & parseAuthentication with token flag', async () => {
const argv = { token: 'This is the TOKEN content' }
expect(Utils.parseAutentication(argv)).toEqual({
expect(Utils.parseAuthentication(argv)).toEqual({
Authorization: 'Bearer This is the TOKEN content'
})
expect(Utils.hasAutentication(argv)).toEqual(true)
expect(Utils.hasAuthentication(argv)).toEqual(true)
})

test('hasAutentication & parseAutentication with token and cookie flags', async () => {
test('hasAuthentication & parseAuthentication with token and cookie flags', async () => {
const argv = {
cookie: 'This is the COOKIE content',
token: 'This is the TOKEN content'
}
expect(Utils.parseAutentication(argv)).toEqual({
expect(Utils.parseAuthentication(argv)).toEqual({
Cookie: 'This is the COOKIE content',
Authorization: 'Bearer This is the TOKEN content'
})
expect(Utils.hasAutentication(argv)).toEqual(true)
expect(Utils.hasAuthentication(argv)).toEqual(true)
})
})
4 changes: 2 additions & 2 deletions bin/is-website-vulnerable.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ function getLighthouseOptions() {
lighthouseOpts.emulatedFormFactor = Utils.parseDevice(argv)
}

if (Utils.hasAutentication(argv)) {
lighthouseOpts.extraHeaders = Utils.parseAutentication(argv)
if (Utils.hasAuthentication(argv)) {
lighthouseOpts.extraHeaders = Utils.parseAuthentication(argv)
}

const { chromePath } = argv
Expand Down
4 changes: 2 additions & 2 deletions src/Utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ module.exports = {
hasDevice: function(argv) {
return argv.mobile || argv.desktop || argv.none || false
},
parseAutentication: function(argv) {
parseAuthentication: function(argv) {
const extraHeaders = {}
if (argv.cookie) {
extraHeaders.Cookie = argv.cookie
Expand All @@ -55,7 +55,7 @@ module.exports = {

return extraHeaders
},
hasAutentication: function(argv) {
hasAuthentication: function(argv) {
return ['cookie', 'token'].some(prop => Object.hasOwnProperty.call(argv, prop))
}
}

0 comments on commit 9a1eb28

Please sign in to comment.