From 2b2d05dd16089b09a0516e89dff320e8c4fd7e02 Mon Sep 17 00:00:00 2001 From: Samuel Lippert Date: Fri, 12 Aug 2022 14:55:30 -0500 Subject: [PATCH] Add to Deno test --- deno_test/index.test.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/deno_test/index.test.ts b/deno_test/index.test.ts index c1129d3d..9b4738f3 100644 --- a/deno_test/index.test.ts +++ b/deno_test/index.test.ts @@ -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')) + app.get('/sentry/error', () => { + throw new Error('a catastrophic error') + }) - const req = new Request('http://localhost/sentry/foo') - const res = await app.fetch(req, {}, new Context()) + 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) })