/
basic.test.ts
43 lines (35 loc) · 1.65 KB
/
basic.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
42
43
import { setupTest, get } from '@nuxt/test-utils'
describe('basic', () => {
setupTest({
server: true,
fixture: 'fixture/basic'
})
test('has prefetch link', async () => {
const { body } = await get('/')
expect(body).toContain('<link data-n-head="ssr" data-hid="gf-prefetch" rel="dns-prefetch" href="https://fonts.gstatic.com/">')
})
test('has preconnect link to font origin', async () => {
const { body } = await get('/')
expect(body).toContain('<link data-n-head="ssr" data-hid="gf-preconnect" rel="preconnect" href="https://fonts.gstatic.com/" crossorigin="">')
})
test('has preconnect link to font stylesheet origin', async () => {
const { body } = await get('/')
expect(body).toContain('<link data-n-head="ssr" data-hid="gf-origin-preconnect" rel="preconnect" href="https://fonts.googleapis.com/">')
})
test('does not have preload link by default', async () => {
const { body } = await get('/')
expect(body).not.toContain('<link data-n-head="ssr" data-hid="gf-preload" rel="preload" as="style" href="https://fonts.googleapis.com/css2?family=Roboto&family=Lato">')
})
test('no has stylesheet link', async () => {
const { body } = await get('/')
expect(body).not.toContain('<link data-n-head="ssr" data-hid="gf-style" rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Roboto&family=Lato">')
})
test('has script to import font css', async () => {
const { body } = await get('/')
expect(body).toContain('data-hid="gf-script"')
})
test('has noscript fallback', async () => {
const { body } = await get('/')
expect(body).toContain('data-hid="gf-noscript"')
})
})