UNPKG

basico-libreriasui

Version:

Esta es una libreria en la que tu podras importar componentes de mi practica de platzi

43 lines (41 loc) 1.15 kB
import { render } from '@testing-library/react'; import MediaImg from './MediaImg'; import '@testing-library/jest-dom/extend-expect'; describe('@components/MediaImg', () => { it('kinewofinweoifnoine', () => { //arrange const { getByRole } = render( <MediaImg alt="PlatziCoolImg" src="http://www.platziversosupercool.com/img" /> ); //act const MediaImgTest = getByRole('img'); //assert expect(MediaImgTest).toBeInTheDocument(); expect(MediaImgTest).toHaveAttribute( 'src', 'http://www.platziversosupercool.com/img' ); expect(MediaImgTest).toHaveAttribute('alt', 'PlatziCoolImg'); }); it('Probar que el width y height sean 200px y border-radius 8px', () => { //arrange const { getByRole } = render( <MediaImg alt="PlatziCoolImg" src="http://www.platziversosupercool.com/img" width="200px" height="200px" borderRadius="8px" /> ); //act const MediaImgTest = getByRole('img'); //assert expect(MediaImgTest).toHaveStyle( 'width:200px;height:200px;border-radius:8px;' ); }); });