Unverified Commit c6fe20a3 authored by Tim Neutkens's avatar Tim Neutkens Committed by GitHub

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 #

-->
parent dc1b565f
...@@ -495,13 +495,13 @@ createNextDescribe( ...@@ -495,13 +495,13 @@ createNextDescribe(
'og:image:alt': 'A alt txt for og', 'og:image:alt': 'A alt txt for og',
'og:image': isNextDev 'og:image': isNextDev
? expect.stringMatching( ? expect.stringMatching(
/http:\/\/localhost:\d+\/opengraph\/static\/opengraph-image.png\?b76e8f0282c93c8e/ /http:\/\/localhost:\d+\/opengraph\/static\/opengraph-image/
) )
: expect.stringMatching( : expect.stringMatching(
new RegExp( new RegExp(
`https:\\/\\/(${ `https:\\/\\/(${
isNextDeploy ? '.*?\\.vercel\\.app' : 'example\\.com' isNextDeploy ? '.*?\\.vercel\\.app' : 'example\\.com'
})\\/opengraph\\/static\\/opengraph-image.png\\?b76e8f0282c93c8e` })\\/opengraph\\/static\\/opengraph-image`
) )
), ),
}) })
...@@ -509,13 +509,13 @@ createNextDescribe( ...@@ -509,13 +509,13 @@ createNextDescribe(
await match('meta', 'name', 'content', { await match('meta', 'name', 'content', {
'twitter:image': isNextDev 'twitter:image': isNextDev
? expect.stringMatching( ? expect.stringMatching(
/http:\/\/localhost:\d+\/opengraph\/static\/twitter-image.png\?b76e8f0282c93c8e/ /http:\/\/localhost:\d+\/opengraph\/static\/twitter-image/
) )
: expect.stringMatching( : expect.stringMatching(
new RegExp( new RegExp(
`https:\\/\\/(${ `https:\\/\\/(${
isNextDeploy ? '.*?\\.vercel\\.app' : 'example\\.com' isNextDeploy ? '.*?\\.vercel\\.app' : 'example\\.com'
})\\/opengraph\\/static\\/twitter-image.png\\?b76e8f0282c93c8e` })\\/opengraph\\/static\\/twitter-image`
) )
), ),
'twitter:image:alt': 'A alt txt for twitter', 'twitter:image:alt': 'A alt txt for twitter',
...@@ -705,13 +705,11 @@ createNextDescribe( ...@@ -705,13 +705,11 @@ createNextDescribe(
const $icon = $('head > link[rel="icon"][type!="image/x-icon"]') const $icon = $('head > link[rel="icon"][type!="image/x-icon"]')
const $appleIcon = $('head > link[rel="apple-touch-icon"]') const $appleIcon = $('head > link[rel="apple-touch-icon"]')
expect($icon.attr('href')).toMatch( expect($icon.attr('href')).toMatch(/\/icons\/static\/nested\/icon1/)
/\/icons\/static\/nested\/icon1\.png\?399de3b94b888afc/
)
expect($icon.attr('sizes')).toBe('32x32') expect($icon.attr('sizes')).toBe('32x32')
expect($icon.attr('type')).toBe('image/png') expect($icon.attr('type')).toBe('image/png')
expect($appleIcon.attr('href')).toMatch( expect($appleIcon.attr('href')).toMatch(
/\/icons\/static\/nested\/apple-icon\.png\?b76e8f0282c93c8e/ /\/icons\/static\/nested\/apple-icon/
) )
expect($appleIcon.attr('type')).toBe('image/png') expect($appleIcon.attr('type')).toBe('image/png')
expect($appleIcon.attr('sizes')).toMatch('114x114') expect($appleIcon.attr('sizes')).toMatch('114x114')
...@@ -722,9 +720,7 @@ createNextDescribe( ...@@ -722,9 +720,7 @@ createNextDescribe(
const $icon = $('head > link[rel="icon"][type!="image/x-icon"]') const $icon = $('head > link[rel="icon"][type!="image/x-icon"]')
expect($icon.attr('href')).toMatch( expect($icon.attr('href')).toMatch(/\/icons\/static\/icon/)
/\/icons\/static\/icon\.png\?b76e8f0282c93c8e/
)
expect($icon.attr('sizes')).toBe('114x114') expect($icon.attr('sizes')).toBe('114x114')
// No apple icon if it's not provided // No apple icon if it's not provided
...@@ -735,14 +731,14 @@ createNextDescribe( ...@@ -735,14 +731,14 @@ createNextDescribe(
const $dynamicIcon = $dynamic('head > link[rel="icon"]') const $dynamicIcon = $dynamic('head > link[rel="icon"]')
const dynamicIconHref = $dynamicIcon.attr('href') const dynamicIconHref = $dynamicIcon.attr('href')
expect(dynamicIconHref).toMatch( expect(dynamicIconHref).toMatch(
/\/icons\/static\/dynamic-routes\/123\/icon\.png\?b76e8f0282c93c8e/ /\/icons\/static\/dynamic-routes\/123\/icon/
) )
const dynamicIconRes = await next.fetch(dynamicIconHref) const dynamicIconRes = await next.fetch(dynamicIconHref)
expect(dynamicIconRes.status).toBe(200) expect(dynamicIconRes.status).toBe(200)
}) })
if (isNextDev) { if (isNextDev) {
it('should handle hmr updates to the file icon', async () => { it('should handle updates to the file icon name and order', async () => {
await next.renameFile( await next.renameFile(
'app/icons/static/icon.png', 'app/icons/static/icon.png',
'app/icons/static/icon2.png' 'app/icons/static/icon2.png'
...@@ -752,7 +748,7 @@ createNextDescribe( ...@@ -752,7 +748,7 @@ createNextDescribe(
const $ = await next.render$('/icons/static') const $ = await next.render$('/icons/static')
const $icon = $('head > link[rel="icon"][type!="image/x-icon"]') const $icon = $('head > link[rel="icon"][type!="image/x-icon"]')
return $icon.attr('href') return $icon.attr('href')
}, /\/icons\/static\/icon2\.png\?b76e8f0282c93c8e/) }, /\/icons\/static\/icon2/)
await next.renameFile( await next.renameFile(
'app/icons/static/icon2.png', 'app/icons/static/icon2.png',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment