Skip to content

Commit 573e70d

Browse files
committed
Fix test for Turbopack
1 parent 18b1448 commit 573e70d

File tree

1 file changed

+7
-4
lines changed
  • test/integration/image-optimizer/test

1 file changed

+7
-4
lines changed

test/integration/image-optimizer/test/util.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1427,9 +1427,12 @@ export function runTests(ctx: RunTestsCtx) {
14271427

14281428
it('should set cache-control to immutable for static images', async () => {
14291429
if (!ctx.isDev) {
1430-
const filename = 'test'
1430+
const filename = fs
1431+
.readdirSync(join(ctx.appDir, '.next/static/media'))
1432+
.find((f) => /^test\.[0-9a-f]+\.jpg$/.test(f))
1433+
expect(filename).toBeString()
14311434
const query = {
1432-
url: `/_next/static/media/${filename}.fab2915d.jpg`,
1435+
url: `/_next/static/media/${filename}`,
14331436
w: ctx.w,
14341437
q: 100,
14351438
}
@@ -1442,7 +1445,7 @@ export function runTests(ctx: RunTestsCtx) {
14421445
)
14431446
expect(res1.headers.get('Vary')).toBe('Accept')
14441447
expect(res1.headers.get('Content-Disposition')).toBe(
1445-
`${contentDispositionType}; filename="${filename}.webp"`
1448+
`${contentDispositionType}; filename="test.webp"`
14461449
)
14471450
await expectWidth(res1, ctx.w)
14481451

@@ -1454,7 +1457,7 @@ export function runTests(ctx: RunTestsCtx) {
14541457
)
14551458
expect(res2.headers.get('Vary')).toBe('Accept')
14561459
expect(res2.headers.get('Content-Disposition')).toBe(
1457-
`${contentDispositionType}; filename="${filename}.webp"`
1460+
`${contentDispositionType}; filename="test.webp"`
14581461
)
14591462
await expectWidth(res2, ctx.w)
14601463
}

0 commit comments

Comments
 (0)