2023-05-04 10:17:00 +02:00
|
|
|
import { createNext, FileRef } from 'e2e-utils'
|
|
|
|
import { NextInstance } from 'test/lib/next-modes/base'
|
2023-05-17 15:37:47 +02:00
|
|
|
import { fetchViaHTTP, findPort } from 'next-test-utils'
|
2023-05-04 10:17:00 +02:00
|
|
|
|
|
|
|
describe('app dir - metadata missing metadataBase', () => {
|
|
|
|
let next: NextInstance
|
2023-05-17 15:37:47 +02:00
|
|
|
let port: number
|
2023-05-04 10:17:00 +02:00
|
|
|
|
|
|
|
if ((global as any).isNextDeploy) {
|
|
|
|
return it('should skip for deploy', () => {})
|
|
|
|
}
|
|
|
|
|
|
|
|
beforeAll(async () => {
|
2023-05-17 15:37:47 +02:00
|
|
|
port = await findPort()
|
2023-05-04 10:17:00 +02:00
|
|
|
next = await createNext({
|
|
|
|
skipStart: true,
|
|
|
|
files: new FileRef(__dirname),
|
2023-05-17 15:37:47 +02:00
|
|
|
forcedPort: port + '',
|
2023-05-04 10:17:00 +02:00
|
|
|
})
|
|
|
|
})
|
|
|
|
afterAll(() => next.destroy())
|
|
|
|
|
|
|
|
it('should fallback to localhost if metadataBase is missing for absolute urls resolving', async () => {
|
|
|
|
await next.start()
|
|
|
|
await fetchViaHTTP(next.url, '/')
|
|
|
|
expect(next.cliOutput).toInclude(
|
2023-07-07 02:08:10 +02:00
|
|
|
'metadata.metadataBase is not set for resolving social open graph or twitter images, using'
|
2023-05-04 10:17:00 +02:00
|
|
|
)
|
2023-05-17 15:37:47 +02:00
|
|
|
expect(next.cliOutput).toInclude(`"http://localhost:${port}`)
|
2023-05-04 10:17:00 +02:00
|
|
|
expect(next.cliOutput).toInclude(
|
2023-05-11 20:52:29 +02:00
|
|
|
'. See https://nextjs.org/docs/app/api-reference/functions/generate-metadata#metadatabase'
|
2023-05-04 10:17:00 +02:00
|
|
|
)
|
|
|
|
})
|
|
|
|
})
|