UNPKG

quickbuild

Version:

A mature, feature-complete application generator with an emphasis on speed

28 lines (22 loc) 868 B
import React from 'react'; import { render } from 'react-testing-library'; import Wrapper from '../Wrapper'; describe('<Wrapper />', () => { it('should render an <div> tag', () => { const { container } = render(<Wrapper />); expect(container.querySelector('div')).not.toBeNull(); }); it('should have a class attribute', () => { const { container } = render(<Wrapper />); expect(container.querySelector('div').hasAttribute('class')).toBe(true); }); it('should adopt a valid attribute', () => { const id = 'test'; const { container } = render(<Wrapper id={id} />); expect(container.querySelector('div').id).toEqual(id); }); it('should not adopt an invalid attribute', () => { const { container } = render(<Wrapper attribute="test" />); expect(container.querySelector('div[attribute="test"]')).toBeNull(); }); });