/
unused.test.ts
47 lines (41 loc) · 1.35 KB
/
unused.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
44
45
46
47
/* eslint-env jest */
import { nextTestSetup } from 'e2e-utils'
describe('unused scss', () => {
describe('Body is not hidden when unused in Development', () => {
const { next, isNextDev } = nextTestSetup({
files: __dirname,
dependencies: {
sass: '1.54.0',
},
})
;(isNextDev ? describe : describe.skip)('development only', () => {
it('should have body visible', async () => {
const browser = await next.browser('/')
const currentDisplay = await browser.eval(
`window.getComputedStyle(document.querySelector('body')).display`
)
expect(currentDisplay).toBe('block')
})
})
})
describe('Body is not hidden when broken in Development', () => {
const { next, isNextDev } = nextTestSetup({
files: __dirname,
dependencies: {
sass: '1.54.0',
},
})
;(isNextDev ? describe : describe.skip)('development only', () => {
it('should have body visible', async () => {
await next.patchFile('pages/index.js', (contents) => {
return contents.replace('<div />', '<div>')
})
const browser = await next.browser('/')
const currentDisplay = await browser.eval(
`window.getComputedStyle(document.querySelector('body')).display`
)
expect(currentDisplay).toBe('block')
})
})
})
})