Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
msimerson committed Feb 28, 2024
1 parent 3127e96 commit f94a83b
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 29 deletions.
7 changes: 7 additions & 0 deletions .eslintrc.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
env:
node: true
es6: true
es2021: true
es2024: true
extends: eslint:recommended
parser: '@babel/eslint-parser'
parserOptions:
babelOptions:
configFile: false
plugins: [ "@babel/plugin-syntax-import-attributes" ]
requireConfigFile: false
ecmaVersion: latest
sourceType: module
rules: {}
8 changes: 4 additions & 4 deletions lib/permission.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ class Permission {
async delete(args, val) {
const g = await this.get(args)
if (g.length !== 1) return false
await Mysql.execute(
`UPDATE nt_perm SET deleted=? WHERE nt_perm_id=?`,
[val ?? 1, g[0].id],
)
await Mysql.execute(`UPDATE nt_perm SET deleted=? WHERE nt_perm_id=?`, [
val ?? 1,
g[0].id,
])
return true
}

Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
},
"homepage": "https://github.com/NicTool/api#readme",
"devDependencies": {
"@babel/eslint-parser": "^7.23.10",
"@babel/plugin-syntax-import-attributes": "^7.23.3",
"eslint": "^8.57.0"
},
"dependencies": {
Expand Down
18 changes: 0 additions & 18 deletions routes/session.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ const parseCookie = (c) => {
}

describe('session routes', () => {
let sessionCookie

const routes = [{ GET: '/' }, { DELETE: '/session' }]

describe('no session responds with 401', () => {
Expand All @@ -44,22 +42,6 @@ describe('session routes', () => {
}
})

describe('valid auth sets a cookie', () => {
it('POST /session', async () => {
const res = await server.inject({
method: 'POST',
url: '/session',
payload: {
username: `${userCase.username}@${groupCase.name}`,
password: userCase.password,
},
})
assert.equal(res.statusCode, 200)
assert.ok(res.headers['set-cookie'][0])
sessionCookie = parseCookie(res.headers['set-cookie'][0])
})
})

describe('with session, can retrieve private URIs', () => {
let sessionCookie

Expand Down
14 changes: 7 additions & 7 deletions test/suite.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ async function createTestUser() {
await User.create(userCaseR)
}

async function createTestSession() {
await Session.create({
nt_user_id: userCase.nt_user_id,
nt_user_session: '3.0.0',
last_access: parseInt(Date.now(), 10),
})
}
// async function createTestSession() {
// await Session.create({
// nt_user_id: userCase.nt_user_id,
// nt_user_session: '3.0.0',
// last_access: parseInt(Date.now(), 10),
// })
// }

async function teardown() {
await destroyTestSession()
Expand Down

0 comments on commit f94a83b

Please sign in to comment.