Skip to content

Latest commit

 

History

History
19 lines (13 loc) · 519 Bytes

File metadata and controls

19 lines (13 loc) · 519 Bytes

HTTP Saver JSR

Save API responses for testing.

Usage

const httpSaver = new HttpSaver()

Deno.test('some API', () => {
    using _ = httpSaver.stubFetch()

    // First time the test runs, the response will be saved under `_fixtures/responses`
    // Subsequent test runs will use the saved response, without making a network request
    const res = await fetch('https://api.example.com')

    // ... do something with `res`
})