Skip to content

deno-libs/superfetch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

88 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

superfetch

GitHub Workflow Status Codecov

HTTP Server testing library inspired by node-supertest-fetch.

Example

Basic testing

import { describe, it } from 'jsr:@std/testing/bdd'
import { makeFetch } from 'jsr:@deno-libs/superfetch'

describe('makeFetch', () => {
  it('should work with HTTP handler', async () => {
    const handler = (res) => new Response('Hello World')

    const fetch = makeFetch(s)

    const res = await fetch('/')
    
    res.expect('Hello World')
  })

run()

Full access to Response and port

import { describe, it } from 'jsr:@std/testing/bdd'
import { makeFetch } from 'jsr:@deno-libs/superfetch'

describe('makeFetch', () => {
  it('should work with HTTP handler', async () => {
    const handler = (res) => new Response('Hello World')

    const fetch = makeFetch(s)

    const res = await fetch('/')
    
    res.expect('Hello World')
    console.log(res) // server response object
    console.log(res.port) // port on which the server was listening
  })

run()

About

πŸ• HTTP Server testing library inspired by node-supertest-fetch.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

Contributors 3

  •  
  •  
  •  
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy