import React from 'react'; import { render } from '../../test-utils'; import 'jest-styled-components'; import { QuizButton } from '..'; import { Size } from '../../types'; import COLORS from '../../styles/colors'; import '@testing-library/jest-dom'; describe('',()=>{ it('renders correct quiz button', async () => { const{getByText, getByTestId} = render( ); expect(getByTestId('txtContainer')).toHaveTextContent('this is sample text'); expect(getByTestId('txtContainer')).toHaveClass('quiz-button-text'); expect(getByTestId('btnContainer')).toHaveClass('quiz-button-icon'); }); it('renders incorrect quiz button', async () => { const{getByText, getByTestId} = render( ); expect(getByTestId('txtContainer')).toHaveTextContent('this is sample text'); expect(getByTestId('txtContainer')).toHaveClass('quiz-button-text'); expect(getByTestId('btnContainer')).toHaveClass('quiz-button-icon'); }); it('renders partial quiz button', async () => { const{getByText, getByTestId} = render( ); expect(getByTestId('txtContainer')).toHaveTextContent('this is sample text'); expect(getByTestId('txtContainer')).toHaveClass('quiz-button-text'); expect(getByTestId('btnContainer')).toHaveClass('quiz-button-icon'); }); it('renders quiz button', async () => { const{getByText, getByTestId} = render( ); expect(getByText('this is sample text')).toHaveTextContent('this is sample text'); expect(getByTestId('txtContainer')).toHaveStyleRule('background',COLORS.accent1_20); expect(getByTestId('btnContainer')).toHaveStyleRule('background',COLORS.accent1_100); }); it('renders selected quiz button', async () => { const{getByText} = render( ); expect(getByText('this is sample text')).toHaveTextContent('this is sample text'); }); });