Skip to content

Commit 4bd1abb

Browse files
committed
test: relax content-type check a bit
1 parent 30ecbf5 commit 4bd1abb

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

plugin/test/fixtures/v4/functions-without-gatsby-plugin/e2e-tests/test-helpers.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ exports.runTests = function runTests(env, host) {
115115
expect(result).toEqual({
116116
amIJSON: true,
117117
})
118-
expect(res.headers.get('content-type')).toEqual('application/json')
118+
expect(res.headers.get('content-type')).toMatch(/^application\/json/)
119119
})
120120
test(`returns json correctly via send`, async () => {
121121
const res = await fetchTwice(`${host}/api/i-am-json-too`)
@@ -124,14 +124,14 @@ exports.runTests = function runTests(env, host) {
124124
expect(result).toEqual({
125125
amIJSON: true,
126126
})
127-
expect(res.headers.get('content-type')).toEqual('application/json')
127+
expect(res.headers.get('content-type')).toMatch(/^application\/json/)
128128
})
129129
test(`returns boolean correctly via send`, async () => {
130130
const res = await fetchTwice(`${host}/api/i-am-false`)
131131
const result = await res.json()
132132

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

plugin/test/fixtures/v5/functions-without-gatsby-plugin/e2e-tests/test-helpers.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ exports.runTests = function runTests(env, host) {
115115
expect(result).toEqual({
116116
amIJSON: true,
117117
})
118-
expect(res.headers.get('content-type')).toEqual('application/json')
118+
expect(res.headers.get('content-type')).toMatch(/^application\/json/)
119119
})
120120
test(`returns json correctly via send`, async () => {
121121
const res = await fetchTwice(`${host}/api/i-am-json-too`)
@@ -124,14 +124,14 @@ exports.runTests = function runTests(env, host) {
124124
expect(result).toEqual({
125125
amIJSON: true,
126126
})
127-
expect(res.headers.get('content-type')).toEqual('application/json')
127+
expect(res.headers.get('content-type')).toMatch(/^application\/json/)
128128
})
129129
test(`returns boolean correctly via send`, async () => {
130130
const res = await fetchTwice(`${host}/api/i-am-false`)
131131
const result = await res.json()
132132

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

plugin/test/fixtures/v5/with-adapters/e2e-tests/test-helpers.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ exports.runTests = function runTests(env, host) {
117117
expect(result).toEqual({
118118
amIJSON: true,
119119
})
120-
expect(res.headers.get('content-type')).toEqual('application/json')
120+
expect(res.headers.get('content-type')).toMatch(/^application\/json/)
121121
})
122122
test(`returns json correctly via send`, async () => {
123123
const res = await fetchTwice(`${host}/api/i-am-json-too`)
@@ -126,14 +126,14 @@ exports.runTests = function runTests(env, host) {
126126
expect(result).toEqual({
127127
amIJSON: true,
128128
})
129-
expect(res.headers.get('content-type')).toEqual('application/json')
129+
expect(res.headers.get('content-type')).toMatch(/^application\/json/)
130130
})
131131
test(`returns boolean correctly via send`, async () => {
132132
const res = await fetchTwice(`${host}/api/i-am-false`)
133133
const result = await res.json()
134134

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

0 commit comments

Comments
 (0)