Skip to content

Commit

Permalink
4 act errors removed from SelectFilterPlugin test
Browse files Browse the repository at this point in the history
  • Loading branch information
lyndsiWilliams committed Sep 9, 2022
1 parent 08a4cbd commit fca5e20
Showing 1 changed file with 24 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import { NULL_STRING } from 'src/utils/common';
import SelectFilterPlugin from './SelectFilterPlugin';
import transformProps from './transformProps';

jest.useFakeTimers();

const selectMultipleProps = {
formData: {
sortAscending: true,
Expand Down Expand Up @@ -86,7 +88,7 @@ describe('SelectFilterPlugin', () => {
jest.clearAllMocks();
});

it('Add multiple values with first render', () => {
test('Add multiple values with first render', async () => {
getWrapper();
expect(setDataMask).toHaveBeenCalledWith({
extraFormData: {},
Expand Down Expand Up @@ -114,6 +116,7 @@ describe('SelectFilterPlugin', () => {
});
userEvent.click(screen.getByRole('combobox'));
userEvent.click(screen.getByTitle('girl'));
expect(await screen.findByTitle(/girl/i)).toBeInTheDocument();
expect(setDataMask).toHaveBeenCalledWith({
__cache: {
value: ['boy'],
Expand All @@ -134,9 +137,14 @@ describe('SelectFilterPlugin', () => {
});
});

it('Remove multiple values when required', () => {
test('Remove multiple values when required', () => {
getWrapper();
userEvent.click(document.querySelector('[data-icon="close"]')!);
userEvent.click(
screen.getByRole('img', {
name: /close-circle/i,
hidden: true,
}),
);
expect(setDataMask).toHaveBeenCalledWith({
__cache: {
value: ['boy'],
Expand All @@ -157,9 +165,14 @@ describe('SelectFilterPlugin', () => {
});
});

it('Remove multiple values when not required', () => {
test('Remove multiple values when not required', () => {
getWrapper({ enableEmptyFilter: false });
userEvent.click(document.querySelector('[data-icon="close"]')!);
userEvent.click(
screen.getByRole('img', {
name: /close-circle/i,
hidden: true,
}),
);
expect(setDataMask).toHaveBeenCalledWith({
__cache: {
value: ['boy'],
Expand All @@ -172,9 +185,10 @@ describe('SelectFilterPlugin', () => {
});
});

it('Select single values with inverse', () => {
test('Select single values with inverse', async () => {
getWrapper({ multiSelect: false, inverseSelection: true });
userEvent.click(screen.getByRole('combobox'));
expect(await screen.findByTitle('girl')).toBeInTheDocument();
userEvent.click(screen.getByTitle('girl'));
expect(setDataMask).toHaveBeenCalledWith({
__cache: {
Expand All @@ -196,9 +210,10 @@ describe('SelectFilterPlugin', () => {
});
});

it('Select single null (empty) value', () => {
test('Select single null (empty) value', async () => {
getWrapper();
userEvent.click(screen.getByRole('combobox'));
expect(await screen.findByRole('combobox')).toBeInTheDocument();
userEvent.click(screen.getByTitle(NULL_STRING));
expect(setDataMask).toHaveBeenLastCalledWith({
__cache: {
Expand All @@ -220,9 +235,10 @@ describe('SelectFilterPlugin', () => {
});
});

it('Add ownState with column types when search all options', () => {
test('Add ownState with column types when search all options', async () => {
getWrapper({ searchAllOptions: true, multiSelect: false });
userEvent.click(screen.getByRole('combobox'));
expect(await screen.findByRole('combobox')).toBeInTheDocument();
userEvent.click(screen.getByTitle('girl'));
expect(setDataMask).toHaveBeenCalledWith({
__cache: {
Expand Down

0 comments on commit fca5e20

Please sign in to comment.