-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhome.html.test.js
38 lines (28 loc) · 1.09 KB
/
home.html.test.js
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
import { fireEvent, getByText } from '@testing-library/dom'
import '@testing-library/jest-dom/extend-expect'
import { JSDOM } from 'jsdom'
import fs from 'fs'
import path from 'path'
const html = fs.readFileSync(path.resolve(__dirname, './home.html'), 'utf8');
let dom
let container
describe('home.html', () => {
it('renders a button element', () => {
dom = new JSDOM(html)
container = dom.window.document.body
expect(container.querySelector('button')).toBeInTheDocument()
})
it('renders a button element with text "Users"', () => {
dom = new JSDOM(html)
container = dom.window.document.body
expect(container.querySelector('span').textContent).toBe('Toggle navigation')
})
it('renders a button element', () => {
expect(container.querySelector('button')).not.toBeNull()
expect(getByText(container, 'Sign Out')).toBeInTheDocument()
})
it('renders a button element', () => {
expect(container.querySelector('button')).not.toBeNull()
expect(getByText(container, 'Sign Out')).toBeInTheDocument()
})
})