Sha256: 2c277a83b80caf29aed95c97bd1be7ebe462f34a8a90296fdade5828ecf45b30
Contents?: true
Size: 1.09 KB
Versions: 17
Compression:
Stored size: 1.09 KB
Contents
/* This file provides the base for tests */ import React from 'react' import { render, screen } from '@testing-library/react' import '@testing-library/jest-dom/extend-expect' // Accessbility import { axe, toHaveNoViolations } from 'jest-axe' expect.extend(toHaveNoViolations) /* We can complicate this wrapper as needed. https://testing-library.com/docs/react-testing-library/setup */ // eslint-disable-next-line react/prop-types const TestApp = ({ children }) => { return ( <> { children } </> ) } const customRender = (ui, options) => render(ui, { wrapper: TestApp, ...options }) export * from '@testing-library/react' export { customRender as render } export const renderKit = (Kit, props = {}, newProps = {}) => { const kitProps = { ...props, ...newProps } render(<Kit {...kitProps} />) return screen.getByTestId(kitProps.data.testid) } export const ensureAccessible = async (Kit, props = {}, newProps = {}) => { const kitProps = { ...props, ...newProps } const render = () => <Kit {...kitProps} /> const html = render() expect(await axe(html)).toHaveNoViolations() }
Version data entries
17 entries across 17 versions & 1 rubygems