Add to Deno test
parent
3d3e3a319c
commit
2b2d05dd16
|
@ -1,3 +1,4 @@
|
|||
import { assertNotEquals } from 'https://deno.land/std@0.148.0/testing/asserts.ts'
|
||||
import { sentry } from '../deno_dist/mod.ts'
|
||||
import { assertEquals, Hono } from './deps.ts'
|
||||
|
||||
|
@ -18,8 +19,17 @@ Deno.test('Sentry Middleware', async () => {
|
|||
const app = new Hono()
|
||||
app.use('/sentry/*', sentry())
|
||||
app.get('/sentry/foo', (c) => c.text('foo'))
|
||||
|
||||
const req = new Request('http://localhost/sentry/foo')
|
||||
const res = await app.fetch(req, {}, new Context())
|
||||
assertEquals(res.status, 200)
|
||||
app.get('/sentry/error', () => {
|
||||
throw new Error('a catastrophic error')
|
||||
})
|
||||
|
||||
let req = new Request('http://localhost/sentry/foo')
|
||||
let res = await app.fetch(req, {}, new Context())
|
||||
assertNotEquals(res, null)
|
||||
assertEquals(res.status, 200)
|
||||
|
||||
req = new Request('http://localhost/sentry/error')
|
||||
res = await app.fetch(req, {}, new Context())
|
||||
assertNotEquals(res, null)
|
||||
assertEquals(res.status, 500)
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue