use enzyme library for testing updated some tests
new test for newtag component
This commit is contained in:
@ -1,20 +1,17 @@
|
||||
import React from "react";
|
||||
import ReactDom from 'react-dom'
|
||||
import SideBar from "./SideBar";
|
||||
|
||||
import {render} from '@testing-library/react'
|
||||
import "@testing-library/jest-dom"
|
||||
import {shallow} from "enzyme";
|
||||
|
||||
describe('<SideBar/>', function () {
|
||||
it('renders without crashing ', function () {
|
||||
const div = document.createElement("div");
|
||||
ReactDom.render(<SideBar/>,div);
|
||||
ReactDom.unmountComponentAtNode(div);
|
||||
const wrapper = shallow(<SideBar/>);
|
||||
wrapper.unmount();
|
||||
});
|
||||
|
||||
it('renders childs correctly', function () {
|
||||
const {getByText} = render(<SideBar>test</SideBar>);
|
||||
const randomElement = getByText(/test/i);
|
||||
expect(randomElement).toBeInTheDocument();
|
||||
const wrapper = shallow(<SideBar>test</SideBar>);
|
||||
expect(wrapper.children().text()).toBe("test");
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user