generated from 2021-IBM-Accelerate-SW-Track/lab-1
-
Notifications
You must be signed in to change notification settings - Fork 1
/
App.test.js
33 lines (28 loc) · 951 Bytes
/
App.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
import { render, screen } from '@testing-library/react';
import { unmountComponentAtNode } from 'react-dom';
import App from './App';
let container = null;
beforeEach(() => {
// setup a DOM element as a render target
container = document.createElement("div");
document.body.appendChild(container);
});
afterEach(() => {
// cleanup on exiting
unmountComponentAtNode(container);
container.remove();
container = null;
});
test('test that App component renders', () => {
render(<App />, container);
});
test('test that new-item-button is a button', () => {
render(<App/>, container);
const element = screen.getByTestId('new-item-button');
expect(element.innerHTML.toLowerCase().includes("button")).toBe(true)
});
test('test that new-item-input is an input ', () => {
render(<App/>, container);
const element = screen.getByTestId('new-item-input');
expect(element.innerHTML.toLowerCase().includes("input")).toBe(true)
});