Skip to content

Commit

Permalink
update test
Browse files Browse the repository at this point in the history
  • Loading branch information
huozhi committed Feb 15, 2024
1 parent f7e5a89 commit 7ab9abb
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions test/e2e/app-dir/metadata-warnings/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,20 @@ createNextDescribe(
files: __dirname,
skipDeployment: true,
},
({ next, isNextStart }) => {
({ next, isNextDev }) => {
// If it's start mode, we get the whole logs since they're from build process.
// If it's dev mode, we get the logs after request
function getCliOutput(logStartPosition: number) {
return isNextStart
? next.cliOutput
: next.cliOutput.slice(logStartPosition)
return isNextDev ? next.cliOutput.slice(logStartPosition) : next.cliOutput
}

if (isNextDev) {
it('should not warn metadataBase is missing if there is only absolute url', async () => {
const logStartPosition = next.cliOutput.length
await fetchViaHTTP(next.url, '/absolute-url-og')
const output = getCliOutput(logStartPosition)
expect(output).not.toInclude(METADATA_BASE_WARN_STRING)
})
}

it('should fallback to localhost if metadataBase is missing for absolute urls resolving', async () => {
Expand All @@ -30,13 +37,6 @@ createNextDescribe(
)
})

it('should not warn metadataBase is missing if there is only absolute url', async () => {
const logStartPosition = next.cliOutput.length
await fetchViaHTTP(next.url, '/absolute-url-og')
const output = getCliOutput(logStartPosition)
expect(output).not.toInclude(METADATA_BASE_WARN_STRING)
})

it('should warn for unsupported metadata properties', async () => {
const logStartPosition = next.cliOutput.length
await fetchViaHTTP(next.url, '/unsupported-metadata')
Expand Down

0 comments on commit 7ab9abb

Please sign in to comment.