Skip to content

Commit

Permalink
fix(linting): no-unused-vars (#130)
Browse files Browse the repository at this point in the history
  • Loading branch information
wraithgar authored Apr 30, 2024
1 parent 29e6172 commit 06687c8
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 21 deletions.
3 changes: 1 addition & 2 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,7 @@ class WebLoginNotSupported extends HttpErrorBase {
}
}

const sleep = (ms) =>
new Promise((resolve, reject) => setTimeout(resolve, ms))
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms))

module.exports = {
adduserCouch,
Expand Down
8 changes: 4 additions & 4 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ test('get', t => {
t.notOk(auth, 'no authorization info sent')
return [auth ? 200 : 401, '', {}]
})
return profile.get().then(result => {
return profile.get().then(() => {
return t.fail('GET w/o auth should fail')
}, err => {
t.equal(err.code, 'E401', 'auth errors are passed through')
Expand Down Expand Up @@ -114,7 +114,7 @@ test('login fallback to couch', t => {
.post('/-/v1/login')
.reply(404, { error: 'not found' })
const opener = url => t.fail('called opener', { url })
const prompter = creds => Promise.resolve({
const prompter = () => Promise.resolve({
username: 'blerp',
password: 'prelb',
email: '[email protected]',
Expand Down Expand Up @@ -148,7 +148,7 @@ test('login fallback to couch when web login fails cancels opener promise', t =>
})
}

const prompter = creds => Promise.resolve({
const prompter = () => Promise.resolve({
username: 'blerp',
password: 'prelb',
email: '[email protected]',
Expand Down Expand Up @@ -182,7 +182,7 @@ test('adduser fallback to couch', t => {
.post('/-/v1/login')
.reply(404, { error: 'not found' })
const opener = url => t.fail('called opener', { url })
const prompter = creds => Promise.resolve({
const prompter = () => Promise.resolve({
username: 'blerp',
password: 'prelb',
email: '[email protected]',
Expand Down
30 changes: 15 additions & 15 deletions test/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ t.test('start server', t => server.listen(PORT, t.end))

t.test('login web', t => {
let calledOpener = false
const opener = (url, conf) => new Promise(resolve => {
const opener = () => new Promise(resolve => {
calledOpener = true
resolve()
})
Expand All @@ -182,7 +182,7 @@ t.test('login web', t => {

t.test('adduser web', t => {
let calledOpener = false
const opener = (url, conf) => new Promise(resolve => {
const opener = () => new Promise(resolve => {
calledOpener = true
resolve()
})
Expand All @@ -201,7 +201,7 @@ t.test('adduser web', t => {
t.test('login web by default', t => {
let calledOpener = false

const opener = (url, conf) => new Promise(resolve => {
const opener = () => new Promise(resolve => {
calledOpener = true
resolve()
})
Expand All @@ -222,7 +222,7 @@ t.test('login web by default', t => {

t.test('adduser web', t => {
let calledOpener = false
const opener = (url, conf) => new Promise(resolve => {
const opener = () => new Promise(resolve => {
calledOpener = true
resolve()
})
Expand All @@ -240,7 +240,7 @@ t.test('adduser web', t => {
t.test('adduser web by default', t => {
let calledOpener = false

const opener = (url, conf) => new Promise(resolve => {
const opener = () => new Promise(resolve => {
calledOpener = true
resolve()
})
Expand Down Expand Up @@ -290,12 +290,12 @@ t.test('adduser couch', t => {
t.test('login fallback to couch', t => {
let calledPrompter = false

const opener = (url, conf) => new Promise(resolve => {
const opener = () => new Promise(() => {
throw new Error('should not call opener')
})

const prompter = () => {
return new Promise((resolve, reject) => {
return new Promise((resolve) => {
calledPrompter = true
resolve({
username: 'user',
Expand All @@ -318,12 +318,12 @@ t.test('login fallback to couch', t => {
t.test('adduser fallback to couch', t => {
let calledPrompter = false

const opener = (url, conf) => new Promise(resolve => {
const opener = () => new Promise(() => {
throw new Error('should not call opener')
})

const prompter = () => {
return new Promise((resolve, reject) => {
return new Promise((resolve) => {
calledPrompter = true
resolve({
username: 'user',
Expand Down Expand Up @@ -391,7 +391,7 @@ t.test('501s', t => {

t.test('fail at login step', t => {
const registry = reg + '/invalid-login/'
const opener = (url, conf) => new Promise(resolve => resolve())
const opener = () => new Promise(resolve => resolve())
const prompter = () => {
throw new Error('should not do this')
}
Expand All @@ -412,7 +412,7 @@ t.test('fail at login step', t => {

t.test('fail at login step by having an invalid url', t => {
const registry = reg + '/invalid-login-url/'
const opener = (url, conf) => new Promise(resolve => resolve())
const opener = () => new Promise(resolve => resolve())
const prompter = () => {
throw new Error('should not do this')
}
Expand All @@ -434,7 +434,7 @@ t.test('fail at login step by having an invalid url', t => {

t.test('fail at the done step', t => {
const registry = reg + '/invalid-done/'
const opener = (url, conf) => new Promise(resolve => resolve())
const opener = () => new Promise(resolve => resolve())
const prompter = () => {
throw new Error('should not do this')
}
Expand All @@ -456,7 +456,7 @@ t.test('fail at the done step', t => {
t.test('notoken response from login endpoint (status 200, bad data)', t => {
const registry = reg + '/notoken/'

const opener = (url, conf) => new Promise(resolve => resolve())
const opener = () => new Promise(resolve => resolve())
const prompter = () => {
throw new Error('should not do this')
}
Expand Down Expand Up @@ -486,7 +486,7 @@ t.test('notoken response from login endpoint (status 200, bad data)', t => {
t.test('retry-after 202 response', t => {
const registry = reg + '/retry-after/'

const opener = (url, conf) => new Promise(resolve => resolve())
const opener = () => new Promise(resolve => resolve())
const prompter = () => {
throw new Error('should not do this')
}
Expand All @@ -503,7 +503,7 @@ t.test('retry-after 202 response', t => {
t.test('no retry-after 202 response', t => {
const registry = reg + '/retry-again/'

const opener = (url, conf) => new Promise(resolve => resolve())
const opener = () => new Promise(resolve => resolve())
const prompter = () => {
throw new Error('should not do this')
}
Expand Down

0 comments on commit 06687c8

Please sign in to comment.