Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

Commit

Permalink
Change tests for error.mock.mjs to reflect changes from previous commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
Potherca committed Aug 24, 2024
1 parent de1295c commit a31239e
Showing 1 changed file with 37 additions and 4 deletions.
41 changes: 37 additions & 4 deletions test/thrower.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,46 @@ import * as metro from '../src/metro.mjs'
import throwermw from '../src/mw/thrower.mjs'
import errormw from '../src/mw/error.mock.mjs'

tap.test('start', async t => {
tap.test('Status code in root with trailing slash', async t => {
let c = metro.client().with(errormw()).with(throwermw())
try {
let res = await c.get('/404/')
t.ok(false)
t.fail()
} catch(e) {
t.ok(true)
}
t.pass()
}
t.end()
})

tap.test('Status code in root without trailing slash', async t => {
let c = metro.client().with(errormw()).with(throwermw())
try {
let res = await c.get('/404')
t.fail()
} catch(e) {
t.pass()
}
t.end()
})

tap.test('Status code in nested path with trailing slash', async t => {
let c = metro.client().with(errormw()).with(throwermw())
try {
let res = await c.get('/nested/404/')
t.fail()
} catch(e) {
t.pass()
}
t.end()
})

tap.test('Status code in nested path without trailing slash', async t => {
let c = metro.client().with(errormw()).with(throwermw())
try {
let res = await c.get('/nested/404')
t.fail()
} catch(e) {
t.pass()
}
t.end()
})

0 comments on commit a31239e

Please sign in to comment.