Skip to content
Myr

index.test.ts

This file

Path

src/helper/adapter/index.test.ts

55 lines · 1.3 KiB · TypeScript

Last changed by

chore: let oxfmt sort imports instead of eslint (#5442)Yusuke Wadabefore adoption859e2c2

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

line 1why, one step back
1import { env, getRuntimeKey } from '.'

chore: let oxfmt sort imports instead of eslint (#5442)Yusuke Wadabefore adoption859e2c2

line 2why, one step back
2import { Hono } from '../../hono'

Merge commit from forkYusuke Wadabefore adoptionf0b094d

lines 3–55why, one step back
3
4describe('getRuntimeKey', () => {5 it('Should return the current runtime key', () => {6 // Now, using the `bun run test` command.7 // But `vitest` depending Node.js will run this test so the RuntimeKey will be `node`.8 expect(getRuntimeKey()).toBe('node')9 })10})1112describe('env', () => {13 describe('Types', () => {14 type Env = {15 Bindings: {16 MY_VAR: string17 }18 }1920 it('Should not throw type errors with env has generics', () => {21 const app = new Hono()22 app.get('/var', (c) => {23 const { MY_VAR } = env<{ MY_VAR: string }>(c)24 expectTypeOf<string>(MY_VAR)25 return c.json({26 var: MY_VAR,27 })28 })29 })3031 it('Should not throw type errors with Hono has generics', () => {32 const app = new Hono<Env>()3334 app.get('/var', (c) => {35 const { MY_VAR } = env(c)36 expectTypeOf<string>(MY_VAR)37 return c.json({38 var: MY_VAR,39 })40 })41 })4243 it('Should not throw type errors with env and Hono have generics', () => {44 const app = new Hono<Env>()4546 app.get('/var', (c) => {47 const { MY_VAR } = env<{ MY_VAR: string }>(c)48 expectTypeOf<string>(MY_VAR)49 return c.json({50 var: MY_VAR,51 })52 })53 })54 })55})