ReactJS
1import React from "react";
2import Enzyme, {shallow} from 'enzyme';
3import Adapter from '@wojtekmaj/enzyme-adapter-react-17';
4import {UserBlock} from "../UserBlock";
5
6Enzyme.configure({adapter: new Adapter()});
7
8describe("UserBlock",()=>{
9test("Should render without props",()=>{
10const wrapper = shallow(<UserBlock />);
11expect(wrapper).toBeDefined();
12expect(wrapper.find('Icon').isEmptyRender()).toBeFalsy();
13})
14test("Should render with props",()=>{
15const wrapper = shallow(<UserBlock avatarSrc={"http://test"}/>);
16expect(wrapper).toBeDefined();
17expect(wrapper.find('img').isEmptyRender()).toBeFalsy();
18})
19})
20