parent
1a01ae820a
commit
615b0e7baa
|
@ -1,8 +1,5 @@
|
||||||
import Toucan from 'https://cdn.skypack.dev/toucan-js@2.6.1'
|
import type { Context, Handler } from 'https://raw.githubusercontent.com/honojs/hono/v2.0.6/deno_dist/mod.ts'
|
||||||
import type {
|
import Toucan from "https://cdn.skypack.dev/toucan-js@2.6.1"
|
||||||
Context,
|
|
||||||
Handler,
|
|
||||||
} from 'https://raw.githubusercontent.com/honojs/hono/v2.0.6/deno_dist/mod.ts'
|
|
||||||
|
|
||||||
declare module 'https://raw.githubusercontent.com/honojs/hono/v2.0.6/deno_dist/mod.ts' {
|
declare module 'https://raw.githubusercontent.com/honojs/hono/v2.0.6/deno_dist/mod.ts' {
|
||||||
interface ContextVariableMap {
|
interface ContextVariableMap {
|
||||||
|
|
|
@ -4,17 +4,6 @@ import { assertEquals, Hono } from './deps.ts'
|
||||||
|
|
||||||
// Test just only minimal patterns.
|
// Test just only minimal patterns.
|
||||||
// Because others are tested well in Cloudflare Workers environment already.
|
// Because others are tested well in Cloudflare Workers environment already.
|
||||||
|
|
||||||
// Mock
|
|
||||||
class Context implements ExecutionContext {
|
|
||||||
passThroughOnException(): void {
|
|
||||||
throw new Error('Method not implemented.')
|
|
||||||
}
|
|
||||||
async waitUntil(promise: Promise<any>): Promise<void> {
|
|
||||||
await promise
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Deno.test('Sentry Middleware', async () => {
|
Deno.test('Sentry Middleware', async () => {
|
||||||
const app = new Hono()
|
const app = new Hono()
|
||||||
app.use(
|
app.use(
|
||||||
|
@ -29,12 +18,12 @@ Deno.test('Sentry Middleware', async () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
let req = new Request('http://localhost/sentry/foo')
|
let req = new Request('http://localhost/sentry/foo')
|
||||||
let res = await app.fetch(req, {}, new Context())
|
let res = await app.fetch(req)
|
||||||
assertNotEquals(res, null)
|
assertNotEquals(res, null)
|
||||||
assertEquals(res.status, 200)
|
assertEquals(res.status, 200)
|
||||||
|
|
||||||
req = new Request('http://localhost/sentry/error')
|
req = new Request('http://localhost/sentry/error')
|
||||||
res = await app.fetch(req, {}, new Context())
|
res = await app.fetch(req)
|
||||||
assertNotEquals(res, null)
|
assertNotEquals(res, null)
|
||||||
assertEquals(res.status, 500)
|
assertEquals(res.status, 500)
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue