import * as React from 'react'; import { render } from '@testing-library/react'; import { DefaultTheme } from 'styled-components'; import { themes } from 'styles/theme/themes'; import { SubTitle } from '../SubTitle'; const renderWithTheme = (theme: DefaultTheme) => render(); describe('', () => { it('should render and match the snapshot', () => { const comp = renderWithTheme(themes.light); expect(comp.container.firstChild).toMatchSnapshot(); }); it('should use theme from props', () => { let comp = renderWithTheme(themes.light); expect(comp.container.firstChild).toHaveStyle( `color: ${themes.light.text}`, ); comp = renderWithTheme(themes.dark); expect(comp.container.firstChild).toHaveStyle(`color: ${themes.dark.text}`); }); });