forked from vercel/next.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.test.ts
34 lines (30 loc) · 1.08 KB
/
index.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { createNext, FileRef } from 'e2e-utils'
import { NextInstance } from 'test/lib/next-modes/base'
import { fetchViaHTTP, findPort } from 'next-test-utils'
describe('app dir - metadata missing metadataBase', () => {
let next: NextInstance
let port: number
if ((global as any).isNextDeploy) {
return it('should skip for deploy', () => {})
}
beforeAll(async () => {
port = await findPort()
next = await createNext({
skipStart: true,
files: new FileRef(__dirname),
forcedPort: port + '',
})
})
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(
'metadata.metadataBase is not set for resolving social open graph or twitter images, fallbacks to'
)
expect(next.cliOutput).toInclude(`"http://localhost:${port}`)
expect(next.cliOutput).toInclude(
'. See https://nextjs.org/docs/app/api-reference/functions/generate-metadata#metadatabase'
)
})
})