import * as React from 'react'; import { render } from '@testing-library/react'; import { LoadingIndicator } from '../index'; import { themes } from 'styles/theme/themes'; import { DefaultTheme, ThemeProvider } from 'styled-components'; const renderWithTheme = ( props: Parameters[number] = {}, theme?: DefaultTheme, ) => render( , ); describe('', () => { it('should match snapshot', () => { const loadingIndicator = renderWithTheme(); expect(loadingIndicator.container.firstChild).toMatchSnapshot(); }); it('should match snapshot when props changed', () => { const loadingIndicator = renderWithTheme({ small: true }); expect(loadingIndicator.container.firstChild).toMatchSnapshot(); }); it('should have theme', () => { const loadingIndicator = renderWithTheme(); expect(loadingIndicator.container.querySelector('circle')).toHaveStyle( `stroke: ${themes.light.primary}`, ); }); });