UNPKG

@codecademy/gamut-tests

Version:

Shared component test setup for Gamut applications

31 lines (28 loc) 1.06 kB
import { GamutProvider, theme } from '@codecademy/gamut-styles'; import { setupRtl as setupRtlBase } from 'component-test-setup'; import overArgs from 'lodash/overArgs'; import * as React from 'react'; // See https://skillsoftdev.atlassian.net/wiki/spaces/779a16d9c7ea452eab11b39cbbe771ce/pages/4441315387/Frontend+Unit+Tests for more info import { jsx as _jsx } from "react/jsx-runtime"; export const MockGamutProvider = ({ children, useLogicalProperties }) => { return /*#__PURE__*/_jsx(GamutProvider, { theme: theme, useCache: false, useGlobals: false, useLogicalProperties: useLogicalProperties, children: children }); }; function withMockGamutProvider(WrappedComponent) { const WithBoundaryComponent = props => /*#__PURE__*/_jsx(MockGamutProvider, { children: /*#__PURE__*/_jsx(WrappedComponent, { ...props }) }); return WithBoundaryComponent; } // overArgs isn't fully typed yet for lack of curried generics, so we have to cast it... export const setupRtl = overArgs(setupRtlBase, withMockGamutProvider);