Skip to content

Commit

Permalink
added test coverage to confirm second param of status
Browse files Browse the repository at this point in the history
  • Loading branch information
kwhitley committed Jun 21, 2023
1 parent 41d6750 commit dd29652
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/status.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,22 @@ import 'isomorphic-fetch'
import { describe, expect, it } from 'vitest'
import { status } from './status'

describe('status(code: number): Response', () => {
describe('status(code: number, options?: ResponseInit): Response', () => {
it('creates a no-content Response with the passed code', async () => {
const response = status(204)

expect(response.status).toBe(204)
expect(response.body).toBeFalsy()
})

it('can take a ResponseInit options as second param', async () => {
const response = status(204, {
headers: {
'x-custom': 'FOO'
}
})

expect(response.status).toBe(204)
expect(response.headers.get('x-custom')).toBe('FOO')
})
})

0 comments on commit dd29652

Please sign in to comment.