Skip to content

Commit

Permalink
coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
msimerson committed Mar 6, 2024
1 parent 03341b1 commit 21c638e
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion routes/nameserver.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ function NameserverRoutes(server) {
id: parseInt(request.params.id, 10),
})

if (!nameservers) {
if (nameservers.length === 0) {
return h
.response({
meta: {
Expand Down
12 changes: 12 additions & 0 deletions routes/nameserver.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,18 @@ describe('nameserver routes', () => {
assert.equal(res.statusCode, 200)
})

it(`DELETE /nameserver/${case2Id}`, async () => {
const res = await server.inject({
method: 'DELETE',
url: `/nameserver/${case2Id}`,
headers: {
Cookie: sessionCookie,
},
})
// console.log(res.result)
assert.equal(res.statusCode, 404)
})

it(`GET /nameserver/${case2Id}`, async () => {
const res = await server.inject({
method: 'GET',
Expand Down
12 changes: 12 additions & 0 deletions routes/permission.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,18 @@ describe('permission routes', () => {
assert.equal(res.statusCode, 200)
})

it(`DELETE /permission/${case2Id}`, async () => {
const res = await server.inject({
method: 'DELETE',
url: `/permission/${case2Id}`,
headers: {
Cookie: sessionCookie,
},
})
// console.log(res.result)
assert.equal(res.statusCode, 404)
})

it(`GET /permission/${case2Id}`, async () => {
const res = await server.inject({
method: 'GET',
Expand Down
2 changes: 2 additions & 0 deletions routes/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,12 @@ function UserRoutes(server) {
tags: ['api'],
},
handler: async (request, h) => {

const users = await User.get({
deleted: request.query.deleted ?? 0,
id: parseInt(request.params.id, 10),
})

if (users.length !== 1) {
return h
.response({
Expand Down

0 comments on commit 21c638e

Please sign in to comment.