mirror of
https://github.com/honojs/hono.git
synced 2024-12-01 10:51:01 +00:00
f29761e16b
* chore: move runtime tests into `runtime_tests` * fixed ci
32 lines
800 B
TypeScript
32 lines
800 B
TypeScript
import { unstable_dev } from 'wrangler'
|
|
import type { UnstableDevWorker } from 'wrangler'
|
|
|
|
describe('Wrangler', () => {
|
|
let worker: UnstableDevWorker
|
|
|
|
beforeAll(async () => {
|
|
worker = await unstable_dev('./runtime_tests/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')
|
|
})
|
|
})
|