-
Notifications
You must be signed in to change notification settings - Fork 3.1k
/
component-index-template.spec.ts
46 lines (40 loc) · 1.21 KB
/
component-index-template.spec.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
44
45
46
import { expect } from 'chai'
import dedent from 'dedent'
import componentIndexHtmlGenerator from '../../src/component-index-template'
describe('componentIndexHtmlGenerator', () => {
it('strips spaces and newlines appropriately', () => {
const generator = componentIndexHtmlGenerator()
const expected = dedent`
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>Components App</title>
</head>
<body>
<div data-cy-root></div>
</body>
</html>`
expect(generator()).to.eq(expected)
})
it('handles header modifier', () => {
const generator = componentIndexHtmlGenerator('foobar')
const expected = dedent`
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>Components App</title>
foobar
</head>
<body>
<div data-cy-root></div>
</body>
</html>`
expect(generator()).to.eq(expected)
})
})