Skip to content
Myr

tiny.test.ts

This file

Path

src/preset/tiny.test.ts

42 lines · 964 bytes · TypeScript

Last changed by

Not known.

History of this file

Take it

The walk stopped after 200 commits: lines older than f0b094d point at it.

Merge commit from forkYusuke Wadabefore adoptionf0b094d

lines 1–42why, one step back
1import { getRouterName } from '../helper/dev'
2import { Hono } from './tiny'34describe('hono/tiny preset', () => {5 it('Should have PatternRouter', async () => {6 const app = new Hono()7 expect(getRouterName(app)).toBe('PatternRouter')8 })9})1011describe('Generics for Bindings and Variables', () => {12 interface CloudflareBindings {13 MY_VARIABLE: string14 }1516 it('Should not throw type errors', () => {17 // @ts-expect-error Bindings should extend object18 new Hono<{19 Bindings: number20 }>()2122 const appWithInterface = new Hono<{23 Bindings: CloudflareBindings24 }>()2526 appWithInterface.get('/', (c) => {27 expectTypeOf(c.env.MY_VARIABLE).toMatchTypeOf<string>()28 return c.text('/')29 })3031 const appWithType = new Hono<{32 Bindings: {33 foo: string34 }35 }>()3637 appWithType.get('/', (c) => {38 expectTypeOf(c.env.foo).toMatchTypeOf<string>()39 return c.text('Hello Hono!')40 })41 })42})