Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f00b542

Browse filesBrowse files
authored
test: update assertion to allow image cdn responses be webp (#2729)
1 parent 6a2c39c commit f00b542
Copy full SHA for f00b542

File tree

Expand file treeCollapse file tree

2 files changed

+20
-8
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+20
-8
lines changed

‎tests/e2e/export.test.ts

Copy file name to clipboardExpand all lines: tests/e2e/export.test.ts
+4-2Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,10 @@ test.describe('next/image is using Netlify Image CDN', () => {
6464

6565
expect(nextImageResponse.status()).toBe(200)
6666
// ensure next/image is using Image CDN
67-
// source image is jpg, but when requesting it through Image CDN avif will be returned
68-
expect(await nextImageResponse.headerValue('content-type')).toEqual('image/avif')
67+
// source image is jpg, but when requesting it through Image CDN avif or webp will be returned
68+
expect(['image/avif', 'image/webp']).toContain(
69+
await nextImageResponse.headerValue('content-type'),
70+
)
6971

7072
await expectImageWasLoaded(page.locator('img'))
7173
})

‎tests/e2e/simple-app.test.ts

Copy file name to clipboardExpand all lines: tests/e2e/simple-app.test.ts
+16-6Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,10 @@ test.describe('next/image is using Netlify Image CDN', () => {
119119

120120
expect(nextImageResponse.status()).toBe(200)
121121
// ensure next/image is using Image CDN
122-
// source image is jpg, but when requesting it through Image CDN avif will be returned
123-
expect(await nextImageResponse.headerValue('content-type')).toEqual('image/avif')
122+
// source image is jpg, but when requesting it through Image CDN avif or webp will be returned
123+
expect(['image/avif', 'image/webp']).toContain(
124+
await nextImageResponse.headerValue('content-type'),
125+
)
124126

125127
await expectImageWasLoaded(page.locator('img'))
126128
})
@@ -142,7 +144,9 @@ test.describe('next/image is using Netlify Image CDN', () => {
142144
)
143145

144146
expect(nextImageResponse.status()).toBe(200)
145-
expect(await nextImageResponse.headerValue('content-type')).toEqual('image/avif')
147+
expect(['image/avif', 'image/webp']).toContain(
148+
await nextImageResponse.headerValue('content-type'),
149+
)
146150

147151
await expectImageWasLoaded(page.locator('img'))
148152
})
@@ -164,7 +168,9 @@ test.describe('next/image is using Netlify Image CDN', () => {
164168
)
165169

166170
expect(nextImageResponse.status()).toBe(200)
167-
expect(await nextImageResponse.headerValue('content-type')).toEqual('image/avif')
171+
expect(['image/avif', 'image/webp']).toContain(
172+
await nextImageResponse.headerValue('content-type'),
173+
)
168174

169175
await expectImageWasLoaded(page.locator('img'))
170176
})
@@ -183,7 +189,9 @@ test.describe('next/image is using Netlify Image CDN', () => {
183189
)
184190

185191
expect(nextImageResponse?.status()).toBe(200)
186-
expect(await nextImageResponse.headerValue('content-type')).toEqual('image/avif')
192+
expect(['image/avif', 'image/webp']).toContain(
193+
await nextImageResponse.headerValue('content-type'),
194+
)
187195

188196
await expectImageWasLoaded(page.locator('img'))
189197
})
@@ -203,7 +211,9 @@ test.describe('next/image is using Netlify Image CDN', () => {
203211
)
204212

205213
expect(nextImageResponse.status()).toEqual(200)
206-
expect(await nextImageResponse.headerValue('content-type')).toEqual('image/avif')
214+
expect(['image/avif', 'image/webp']).toContain(
215+
await nextImageResponse.headerValue('content-type'),
216+
)
207217

208218
await expectImageWasLoaded(page.locator('img'))
209219
})

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.