forked from vercel/next.js
/
index.test.ts
41 lines (34 loc) · 1.03 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
35
36
37
38
39
40
41
/* eslint-env jest */
import webdriver from 'next-webdriver'
import { join } from 'path'
import {
renderViaHTTP,
findPort,
launchApp,
killApp,
hasRedbox,
} from 'next-test-utils'
let app
let appPort: number
const appDir = join(__dirname, '../')
describe('next/dynamic with suspense', () => {
beforeAll(async () => {
appPort = await findPort()
app = await launchApp(appDir, appPort)
})
afterAll(() => killApp(app))
it('should render server-side', async () => {
const html = await renderViaHTTP(appPort, '/')
expect(html).toContain('Next.js Example')
expect(html).toContain('Thing')
})
it('should render client-side', async () => {
const browser = await webdriver(appPort, '/')
const warnings = (await browser.log()).map((log) => log.message).join('\n')
expect(await hasRedbox(browser)).toBe(false)
expect(warnings).toMatch(
/"ssr: false" is ignored by next\/dynamic because you can not enable "suspense" while disabling "ssr" at the same time/gim
)
await browser.close()
})
})