File size: 1,340 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
42
43
import { nextTestSetup } from 'e2e-utils'

describe('standalone mode - metadata routes', () => {
  const { next } = nextTestSetup({
    files: __dirname,
    dependencies: {
      swr: 'latest',
    },
  })

  beforeAll(async () => {
    // Hide source files to make sure route.js can read files from source
    // in order to hit the prerender cache
    await next.renameFolder('app', 'app_hidden')
  })

  it('should handle metadata icons correctly', async () => {
    const faviconRes = await next.fetch('/favicon.ico')
    const iconRes = await next.fetch('/icon.svg')
    expect(faviconRes.status).toBe(200)
    expect(iconRes.status).toBe(200)
  })

  it('should handle correctly not-found.js', async () => {
    const res = await next.fetch('/not-found/does-not-exist')
    expect(res.status).toBe(404)
    const html = await res.text()
    expect(html).toContain('app-not-found')
  })

  it('should handle private _next unmatched route correctly', async () => {
    const res = await next.fetch('/_next/does-not-exist')
    expect(res.status).toBe(404)
    const html = await res.text()
    expect(html).toContain('app-not-found')
  })

  it('should handle pages rendering correctly', async () => {
    const browser = await next.browser('/hello')
    expect(await browser.elementByCss('#content').text()).toBe('hello-bar')
  })
})