superfetch
Superdeno-like superagent testing library based on Fetch API. Ported from node-supertest-fetch.
Example
import { describe, it, run } from 'https://deno.land/x/tincan/mod.ts'
import { App } from 'https://deno.land/x/tinyhttp@0.1.6/app.ts'
import { makeFetch } from 'https://deno.land/x/superfetch/mod.ts'
import { ServerRequest } from 'https://deno.land/std@0.97.0/http/server.ts'
describe('makeFetch', () => {
it('should work with tinyhttp', async () => {
const s = new App().use((req) => req.respond({ body: 'Hello World' }))
const fetch = makeFetch(s.attach as (req: ServerRequest) => void)
await fetch('/').expect('Hello World')
})
})
run()