remove Context mock from deno test

It's unnecessary.
pull/31/head
Yusuke Wada 2022-08-13 08:42:45 +09:00
parent 1a01ae820a
commit 615b0e7baa
2 changed files with 4 additions and 18 deletions

View File

@ -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 { Context, Handler } from 'https://raw.githubusercontent.com/honojs/hono/v2.0.6/deno_dist/mod.ts'
import Toucan from "https://cdn.skypack.dev/toucan-js@2.6.1"
declare module 'https://raw.githubusercontent.com/honojs/hono/v2.0.6/deno_dist/mod.ts' {
interface ContextVariableMap {

View File

@ -4,17 +4,6 @@ import { assertEquals, Hono } from './deps.ts'
// Test just only minimal patterns.
// 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 () => {
const app = new Hono()
app.use(
@ -29,12 +18,12 @@ Deno.test('Sentry Middleware', async () => {
})
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)
assertEquals(res.status, 200)
req = new Request('http://localhost/sentry/error')
res = await app.fetch(req, {}, new Context())
res = await app.fetch(req)
assertNotEquals(res, null)
assertEquals(res.status, 500)
})