Skip to content

Commit

Permalink
test: relax content-type check a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
pieh committed Jan 16, 2025
1 parent 30ecbf5 commit 4bd1abb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ exports.runTests = function runTests(env, host) {
expect(result).toEqual({
amIJSON: true,
})
expect(res.headers.get('content-type')).toEqual('application/json')
expect(res.headers.get('content-type')).toMatch(/^application\/json/)
})
test(`returns json correctly via send`, async () => {
const res = await fetchTwice(`${host}/api/i-am-json-too`)
Expand All @@ -124,14 +124,14 @@ exports.runTests = function runTests(env, host) {
expect(result).toEqual({
amIJSON: true,
})
expect(res.headers.get('content-type')).toEqual('application/json')
expect(res.headers.get('content-type')).toMatch(/^application\/json/)
})
test(`returns boolean correctly via send`, async () => {
const res = await fetchTwice(`${host}/api/i-am-false`)
const result = await res.json()

expect(result).toEqual(false)
expect(res.headers.get('content-type')).toEqual('application/json')
expect(res.headers.get('content-type')).toMatch(/^application\/json/)
})
test(`returns status correctly via send`, async () => {
const res = await fetchTwice(`${host}/api/i-am-status`)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ exports.runTests = function runTests(env, host) {
expect(result).toEqual({
amIJSON: true,
})
expect(res.headers.get('content-type')).toEqual('application/json')
expect(res.headers.get('content-type')).toMatch(/^application\/json/)
})
test(`returns json correctly via send`, async () => {
const res = await fetchTwice(`${host}/api/i-am-json-too`)
Expand All @@ -124,14 +124,14 @@ exports.runTests = function runTests(env, host) {
expect(result).toEqual({
amIJSON: true,
})
expect(res.headers.get('content-type')).toEqual('application/json')
expect(res.headers.get('content-type')).toMatch(/^application\/json/)
})
test(`returns boolean correctly via send`, async () => {
const res = await fetchTwice(`${host}/api/i-am-false`)
const result = await res.json()

expect(result).toEqual(false)
expect(res.headers.get('content-type')).toEqual('application/json')
expect(res.headers.get('content-type')).toMatch(/^application\/json/)
})
test(`returns status correctly via send`, async () => {
const res = await fetchTwice(`${host}/api/i-am-status`)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ exports.runTests = function runTests(env, host) {
expect(result).toEqual({
amIJSON: true,
})
expect(res.headers.get('content-type')).toEqual('application/json')
expect(res.headers.get('content-type')).toMatch(/^application\/json/)
})
test(`returns json correctly via send`, async () => {
const res = await fetchTwice(`${host}/api/i-am-json-too`)
Expand All @@ -126,14 +126,14 @@ exports.runTests = function runTests(env, host) {
expect(result).toEqual({
amIJSON: true,
})
expect(res.headers.get('content-type')).toEqual('application/json')
expect(res.headers.get('content-type')).toMatch(/^application\/json/)
})
test(`returns boolean correctly via send`, async () => {
const res = await fetchTwice(`${host}/api/i-am-false`)
const result = await res.json()

expect(result).toEqual(false)
expect(res.headers.get('content-type')).toEqual('application/json')
expect(res.headers.get('content-type')).toMatch(/^application\/json/)
})
test(`returns status correctly via send`, async () => {
const res = await fetchTwice(`${host}/api/i-am-status`)
Expand Down

0 comments on commit 4bd1abb

Please sign in to comment.