0
0
mirror of https://github.com/honojs/hono.git synced 2024-11-25 05:07:03 +01:00
hono/test_wrangler/index.test.ts
Yusuke Wada ad880dba43
feat: env support enviroment variables for multi runtimes (#949)
* feat: `env` support enviroment variables for multi runtimes

* typo

* denoify

* fixed ci settings

* fixed deno command

* comment out lagon test

* remove warnings
2023-03-06 21:12:22 +09:00

32 lines
791 B
TypeScript

import { unstable_dev } from 'wrangler'
import type { UnstableDevWorker } from 'wrangler'
describe('Wrangler', () => {
let worker: UnstableDevWorker
beforeAll(async () => {
worker = await unstable_dev('./test_wrangler/index.ts', {
vars: {
NAME: 'Cloudflare',
},
experimental: { disableExperimentalWarning: true },
})
})
afterAll(async () => {
await worker.stop()
})
it('Should return Hello World', async () => {
const res = await worker.fetch('/')
expect(res.status).toBe(200)
expect(await res.text()).toBe('Hello Wrangler!')
})
it('Should return the environment variable', async () => {
const res = await worker.fetch('/env')
expect(res.status).toBe(200)
expect(await res.text()).toBe('Cloudflare')
})
})