Skip to content

Commit

Permalink
refactor: remove unnecessary @test/utils
Browse files Browse the repository at this point in the history
  • Loading branch information
chanceaclark committed Aug 21, 2024
1 parent 8a7cc32 commit 3cfbe6f
Show file tree
Hide file tree
Showing 51 changed files with 49 additions and 119 deletions.
4 changes: 0 additions & 4 deletions packages/big-design/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ const defaultJestConfig = require('@bigcommerce/configs/jest');

module.exports = {
...defaultJestConfig,
moduleNameMapper: {
...defaultJestConfig.moduleNameMapper,
'@test/utils': '<rootDir>/tests/utils',
},
setupFilesAfterEnv: ['<rootDir>/setupTests.ts'],
coverageThreshold: {
global: {
Expand Down
3 changes: 1 addition & 2 deletions packages/big-design/src/components/AccordionPanel/spec.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { ErrorIcon } from '@bigcommerce/big-design-icons';
import { render, screen } from '@testing-library/react';
import { userEvent } from '@testing-library/user-event';
import React, { useState } from 'react';

import { render, screen } from '@test/utils';

import { Text } from '../Typography';

import { AccordionProps } from './Accordion';
Expand Down
4 changes: 1 addition & 3 deletions packages/big-design/src/components/Alert/spec.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { theme } from '@bigcommerce/big-design-theme';
import { screen } from '@testing-library/react';
import { render, screen } from '@testing-library/react';
import { userEvent } from '@testing-library/user-event';
import React from 'react';
import 'jest-styled-components';

import { render } from '@test/utils';

import { Alert } from './Alert';

test('render default (success) Alert', () => {
Expand Down
3 changes: 1 addition & 2 deletions packages/big-design/src/components/Badge/spec.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { theme } from '@bigcommerce/big-design-theme';
import { render } from '@testing-library/react';
import React from 'react';
import 'jest-styled-components';

import { render } from '@test/utils';

import { Badge } from './index';

test('has margin props', () => {
Expand Down
4 changes: 1 addition & 3 deletions packages/big-design/src/components/Box/spec.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { theme } from '@bigcommerce/big-design-theme';
import { screen } from '@testing-library/react';
import { render, screen } from '@testing-library/react';
import React, { createRef } from 'react';
import 'jest-styled-components';

import { render } from '@test/utils';

import { Box } from './index';

test('has margin props', () => {
Expand Down
4 changes: 1 addition & 3 deletions packages/big-design/src/components/Button/spec.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { AddIcon } from '@bigcommerce/big-design-icons';
import { screen } from '@testing-library/react';
import { render, screen } from '@testing-library/react';
import { userEvent } from '@testing-library/user-event';
import React, { createRef } from 'react';
import 'jest-styled-components';

import { render } from '@test/utils';

import { StyleableButton } from './private';

import { Button } from './index';
Expand Down
3 changes: 1 addition & 2 deletions packages/big-design/src/components/Checkbox/spec.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { render, screen } from '@testing-library/react';
import { userEvent } from '@testing-library/user-event';
import React, { createRef } from 'react';
import 'jest-styled-components';

import { render, screen } from '@test/utils';

import { warning } from '../../utils';

import { CheckboxLabel } from './Label';
Expand Down
4 changes: 1 addition & 3 deletions packages/big-design/src/components/Chip/spec.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { screen } from '@testing-library/react';
import { render, screen } from '@testing-library/react';
import { userEvent } from '@testing-library/user-event';
import React from 'react';
import 'jest-styled-components';

import { render } from '@test/utils';

import { Chip } from './index';

test('renders the label', () => {
Expand Down
4 changes: 1 addition & 3 deletions packages/big-design/src/components/Collapse/spec.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { screen } from '@testing-library/react';
import { render, screen } from '@testing-library/react';
import { userEvent } from '@testing-library/user-event';
import React from 'react';
import 'jest-styled-components';

import { render } from '@test/utils';

import { Text } from '../Typography';

import { Collapse } from './Collapse';
Expand Down
3 changes: 1 addition & 2 deletions packages/big-design/src/components/Counter/spec.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { render, screen } from '@testing-library/react';
import { userEvent } from '@testing-library/user-event';
import React, { createRef, Ref } from 'react';
import 'jest-styled-components';

import { render, screen } from '@test/utils';

import { Button } from '../Button';
import {
Form,
Expand Down
3 changes: 1 addition & 2 deletions packages/big-design/src/components/Datepicker/spec.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import 'jest-styled-components';

import { fireEvent, render, screen, waitFor } from '@testing-library/react';
import { userEvent } from '@testing-library/user-event';
import React, { createRef } from 'react';
import { default as ReactDatePicker } from 'react-datepicker';

import { fireEvent, render, screen, waitFor } from '@test/utils';

import { FormGroup } from '..';

import { Datepicker } from './index';
Expand Down
3 changes: 1 addition & 2 deletions packages/big-design/src/components/Dropdown/spec.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { CheckCircleIcon } from '@bigcommerce/big-design-icons';
import { remCalc } from '@bigcommerce/big-design-theme';
import { act, fireEvent, render, screen } from '@testing-library/react';
import { userEvent } from '@testing-library/user-event';
import React from 'react';
import 'jest-styled-components';

import { act, fireEvent, render, screen } from '@test/utils';

import { Button } from '../Button';

import { Dropdown } from './';
Expand Down
3 changes: 1 addition & 2 deletions packages/big-design/src/components/Fieldset/spec.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { render } from '@testing-library/react';
import React from 'react';
import 'jest-styled-components';

import { render } from '@test/utils';

import { warning } from '../../utils';

import { FieldsetDescription } from './Description';
Expand Down
3 changes: 1 addition & 2 deletions packages/big-design/src/components/FileUploader/spec.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { theme } from '@bigcommerce/big-design-theme';
import { waitFor } from '@testing-library/dom';
import { render, screen } from '@testing-library/react';
import { userEvent } from '@testing-library/user-event';
import React from 'react';

import { render, screen } from '@test/utils';

import { warning } from '../../utils';
import { FormControlLabel, FormGroup } from '../Form';

Expand Down
3 changes: 1 addition & 2 deletions packages/big-design/src/components/Flex/spec.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { render } from '@testing-library/react';
import React, { createRef } from 'react';
import 'jest-styled-components';

import { render } from '@test/utils';

import { Flex, FlexItem } from './index';

test('render flex', () => {
Expand Down
3 changes: 1 addition & 2 deletions packages/big-design/src/components/Form/Description/spec.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { render } from '@testing-library/react';
import React from 'react';
import 'jest-styled-components';

import { render } from '@test/utils';

import { FormControlDescription as Description } from './Description';

test('renders description', () => {
Expand Down
3 changes: 1 addition & 2 deletions packages/big-design/src/components/Form/Group/spec.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { render } from '@testing-library/react';
import React from 'react';
import 'jest-styled-components';

import { render } from '@test/utils';

import { Input } from '../../Input';
import { FormControlError } from '../Error';

Expand Down
2 changes: 1 addition & 1 deletion packages/big-design/src/components/Form/Label/spec.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { render } from '@testing-library/react';
import React from 'react';

import 'jest-styled-components';
import { render } from '@test/utils';

import { FormControlLabel } from './index';

Expand Down
3 changes: 1 addition & 2 deletions packages/big-design/src/components/Form/spec.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { fireEvent, render, screen, waitFor } from '@testing-library/react';
import React, { createRef } from 'react';
import 'jest-styled-components';

import { fireEvent, render, screen, waitFor } from '@test/utils';

import { Fieldset } from '../Fieldset';
import { Input } from '../Input';

Expand Down
3 changes: 1 addition & 2 deletions packages/big-design/src/components/Grid/spec.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { render } from '@testing-library/react';
import React, { createRef } from 'react';
import 'jest-styled-components';

import { render } from '@test/utils';

import { GridItem } from './Item';

import { Grid } from './index';
Expand Down
3 changes: 1 addition & 2 deletions packages/big-design/src/components/InlineMessage/spec.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { theme } from '@bigcommerce/big-design-theme';
import { fireEvent, render, screen } from '@testing-library/react';
import React from 'react';
import 'jest-styled-components';

import { fireEvent, render, screen } from '@test/utils';

import { InlineMessage, InlineMessageProps } from './InlineMessage';

test('renders with margins', () => {
Expand Down
3 changes: 1 addition & 2 deletions packages/big-design/src/components/Input/spec.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { AddIcon } from '@bigcommerce/big-design-icons';
import { theme } from '@bigcommerce/big-design-theme';
import { render, screen } from '@testing-library/react';
import React, { createRef } from 'react';
import 'jest-styled-components';

import { render, screen } from '@test/utils';

import { warning } from '../../utils';
import { FormControlDescription, FormControlError, FormControlLabel, FormGroup } from '../Form';

Expand Down
2 changes: 1 addition & 1 deletion packages/big-design/src/components/Link/spec.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { render } from '@testing-library/react';
import React from 'react';

import 'jest-styled-components';
import { render } from '@test/utils';

import { Link } from './Link';

Expand Down
2 changes: 1 addition & 1 deletion packages/big-design/src/components/Message/spec.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { theme } from '@bigcommerce/big-design-theme';
import { fireEvent, render, screen } from '@testing-library/react';
import React from 'react';

import 'jest-styled-components';
import { fireEvent, render, screen } from '@test/utils';

import { Message, MessageProps } from './Message';

Expand Down
2 changes: 1 addition & 1 deletion packages/big-design/src/components/Modal/spec.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { fireEvent, render, screen, waitFor } from '@testing-library/react';
import React from 'react';

import 'jest-styled-components';
import { fireEvent, render, screen, waitFor } from '@test/utils';

import { Button } from '../Button';
import { Text } from '../Typography';
Expand Down
2 changes: 1 addition & 1 deletion packages/big-design/src/components/Pagination/spec.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { fireEvent, render, screen, waitFor } from '@testing-library/react';
import { userEvent } from '@testing-library/user-event';
import React from 'react';

import 'jest-styled-components';
import { fireEvent, render, screen, waitFor } from '@test/utils';

import { Pagination } from './index';

Expand Down
3 changes: 1 addition & 2 deletions packages/big-design/src/components/Panel/spec.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { theme } from '@bigcommerce/big-design-theme';
import { fireEvent, render, screen } from '@testing-library/react';
import React, { createRef } from 'react';
import 'jest-styled-components';

import { fireEvent, render, screen } from '@test/utils';

import { Text } from '../Typography';

import { Panel } from './Panel';
Expand Down
3 changes: 1 addition & 2 deletions packages/big-design/src/components/Popover/spec.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { theme } from '@bigcommerce/big-design-theme';
import { fireEvent, render, screen } from '@testing-library/react';
import React, { useState } from 'react';

import { fireEvent, render, screen } from '@test/utils';

import { Popover } from './Popover';

import { PopoverProps } from '.';
Expand Down
3 changes: 1 addition & 2 deletions packages/big-design/src/components/ProgressBar/spec.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { render } from '@testing-library/react';
import React from 'react';
import 'jest-styled-components';

import { render } from '@test/utils';

import { ProgressBar } from './ProgressBar';

test('render determinant progress bar', () => {
Expand Down
3 changes: 1 addition & 2 deletions packages/big-design/src/components/ProgressCircle/spec.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import 'jest-styled-components';

import { render } from '@testing-library/react';
import React from 'react';

import { render } from '@test/utils';

import { ProgressCircle } from './ProgressCircle';

test('render determinant progress circle', () => {
Expand Down
3 changes: 1 addition & 2 deletions packages/big-design/src/components/Radio/spec.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { fireEvent, render, screen } from '@testing-library/react';
import React, { createRef } from 'react';
import 'jest-styled-components';

import { fireEvent, render, screen } from '@test/utils';

import { warning } from '../../utils';

import { Radio, RadioLabel } from './index';
Expand Down
3 changes: 1 addition & 2 deletions packages/big-design/src/components/StatefulTable/spec.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { fireEvent, render, screen } from '@testing-library/react';
import React from 'react';
import 'jest-styled-components';

import { fireEvent, render, screen } from '@test/utils';

import { StatefulTable, StatefulTablePillTabFilter, StatefulTableProps } from './StatefulTable';

interface TestItem {
Expand Down
3 changes: 1 addition & 2 deletions packages/big-design/src/components/StatefulTree/spec.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { theme } from '@bigcommerce/big-design-theme';
import { fireEvent, render, screen } from '@testing-library/react';
import { userEvent } from '@testing-library/user-event';
import React from 'react';

import { fireEvent, render, screen } from '@test/utils';

import { StatefulTree, StatefulTreeProps, TreeNodeProps } from '.';

const nodes: Array<TreeNodeProps<number>> = [
Expand Down
3 changes: 1 addition & 2 deletions packages/big-design/src/components/Switch/spec.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { render, screen } from '@testing-library/react';
import { userEvent } from '@testing-library/user-event';
import React, { createRef } from 'react';
import 'jest-styled-components';

import { render, screen } from '@test/utils';

import { Switch } from './index';

describe('render Switch', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { theme as defaultTheme } from '@bigcommerce/big-design-theme';
import 'jest-styled-components';
import { render } from '@testing-library/react';
import React from 'react';
import styled from 'styled-components';

import { render } from '@test/utils';

import { withTableColumnDisplay } from './display';
import { TableColumnDisplayProps } from './types';

Expand Down
3 changes: 1 addition & 2 deletions packages/big-design/src/components/Table/spec.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { fireEvent, render, screen } from '@testing-library/react';
import { userEvent } from '@testing-library/user-event';
import React, { CSSProperties } from 'react';
import 'jest-styled-components';

import { fireEvent, render, screen } from '@test/utils';

import { Table, TableFigure } from './Table';
import { TableColumn, TableItem } from './types';

Expand Down
Loading

0 comments on commit 3cfbe6f

Please sign in to comment.