Skip to content

Commit c6fe20a

Browse files
authoredOct 14, 2023
Remove specific hash checks for metadata.test.ts (#56843)
This ensures the tests pass in both webpack and Turbopack. <!-- Thanks for opening a PR! Your contribution is much appreciated. To make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below. Choose the right checklist for the change(s) that you're making: ## For Contributors ### Improving Documentation - Run `pnpm prettier-fix` to fix formatting issues before opening the PR. - Read the Docs Contribution Guide to ensure your contribution follows the docs guidelines: https://nextjs.org/docs/community/contribution-guide ### Adding or Updating Examples - The "examples guidelines" are followed from our contributing doc https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md - Make sure the linting passes by running `pnpm build && pnpm lint`. See https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md ### Fixing a bug - Related issues linked using `fixes #number` - Tests added. See: https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs - Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md ### Adding a feature - Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. (A discussion must be opened, see https://github.com/vercel/next.js/discussions/new?category=ideas) - Related issues/discussions are linked using `fixes #number` - e2e tests added (https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) - Documentation added - Telemetry added. In case of a feature if it's used or not. - Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md ## For Maintainers - Minimal description (aim for explaining to someone not on the team to understand the PR) - When linking to a Slack thread, you might want to share details of the conclusion - Link both the Linear (Fixes NEXT-xxx) and the GitHub issues - Add review comments if necessary to explain to the reviewer the logic behind a change ### What? ### Why? ### How? Closes NEXT- Fixes # -->
1 parent dc1b565 commit c6fe20a

File tree

1 file changed

+10
-14
lines changed

1 file changed

+10
-14
lines changed
 

‎test/e2e/app-dir/metadata/metadata.test.ts

+10-14
Original file line numberDiff line numberDiff line change
@@ -495,27 +495,27 @@ createNextDescribe(
495495
'og:image:alt': 'A alt txt for og',
496496
'og:image': isNextDev
497497
? expect.stringMatching(
498-
/http:\/\/localhost:\d+\/opengraph\/static\/opengraph-image.png\?b76e8f0282c93c8e/
498+
/http:\/\/localhost:\d+\/opengraph\/static\/opengraph-image/
499499
)
500500
: expect.stringMatching(
501501
new RegExp(
502502
`https:\\/\\/(${
503503
isNextDeploy ? '.*?\\.vercel\\.app' : 'example\\.com'
504-
})\\/opengraph\\/static\\/opengraph-image.png\\?b76e8f0282c93c8e`
504+
})\\/opengraph\\/static\\/opengraph-image`
505505
)
506506
),
507507
})
508508

509509
await match('meta', 'name', 'content', {
510510
'twitter:image': isNextDev
511511
? expect.stringMatching(
512-
/http:\/\/localhost:\d+\/opengraph\/static\/twitter-image.png\?b76e8f0282c93c8e/
512+
/http:\/\/localhost:\d+\/opengraph\/static\/twitter-image/
513513
)
514514
: expect.stringMatching(
515515
new RegExp(
516516
`https:\\/\\/(${
517517
isNextDeploy ? '.*?\\.vercel\\.app' : 'example\\.com'
518-
})\\/opengraph\\/static\\/twitter-image.png\\?b76e8f0282c93c8e`
518+
})\\/opengraph\\/static\\/twitter-image`
519519
)
520520
),
521521
'twitter:image:alt': 'A alt txt for twitter',
@@ -705,13 +705,11 @@ createNextDescribe(
705705
const $icon = $('head > link[rel="icon"][type!="image/x-icon"]')
706706
const $appleIcon = $('head > link[rel="apple-touch-icon"]')
707707

708-
expect($icon.attr('href')).toMatch(
709-
/\/icons\/static\/nested\/icon1\.png\?399de3b94b888afc/
710-
)
708+
expect($icon.attr('href')).toMatch(/\/icons\/static\/nested\/icon1/)
711709
expect($icon.attr('sizes')).toBe('32x32')
712710
expect($icon.attr('type')).toBe('image/png')
713711
expect($appleIcon.attr('href')).toMatch(
714-
/\/icons\/static\/nested\/apple-icon\.png\?b76e8f0282c93c8e/
712+
/\/icons\/static\/nested\/apple-icon/
715713
)
716714
expect($appleIcon.attr('type')).toBe('image/png')
717715
expect($appleIcon.attr('sizes')).toMatch('114x114')
@@ -722,9 +720,7 @@ createNextDescribe(
722720

723721
const $icon = $('head > link[rel="icon"][type!="image/x-icon"]')
724722

725-
expect($icon.attr('href')).toMatch(
726-
/\/icons\/static\/icon\.png\?b76e8f0282c93c8e/
727-
)
723+
expect($icon.attr('href')).toMatch(/\/icons\/static\/icon/)
728724
expect($icon.attr('sizes')).toBe('114x114')
729725

730726
// No apple icon if it's not provided
@@ -735,14 +731,14 @@ createNextDescribe(
735731
const $dynamicIcon = $dynamic('head > link[rel="icon"]')
736732
const dynamicIconHref = $dynamicIcon.attr('href')
737733
expect(dynamicIconHref).toMatch(
738-
/\/icons\/static\/dynamic-routes\/123\/icon\.png\?b76e8f0282c93c8e/
734+
/\/icons\/static\/dynamic-routes\/123\/icon/
739735
)
740736
const dynamicIconRes = await next.fetch(dynamicIconHref)
741737
expect(dynamicIconRes.status).toBe(200)
742738
})
743739

744740
if (isNextDev) {
745-
it('should handle hmr updates to the file icon', async () => {
741+
it('should handle updates to the file icon name and order', async () => {
746742
await next.renameFile(
747743
'app/icons/static/icon.png',
748744
'app/icons/static/icon2.png'
@@ -752,7 +748,7 @@ createNextDescribe(
752748
const $ = await next.render$('/icons/static')
753749
const $icon = $('head > link[rel="icon"][type!="image/x-icon"]')
754750
return $icon.attr('href')
755-
}, /\/icons\/static\/icon2\.png\?b76e8f0282c93c8e/)
751+
}, /\/icons\/static\/icon2/)
756752

757753
await next.renameFile(
758754
'app/icons/static/icon2.png',

0 commit comments

Comments
 (0)
Please sign in to comment.