Skip to content

Commit

Permalink
feat(vadcDataDictionaryTable): Linted test files
Browse files Browse the repository at this point in the history
  • Loading branch information
jarvisraymond-uchicago committed Jan 17, 2024
1 parent 89e9fb8 commit 53d5a16
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
9 changes: 3 additions & 6 deletions src/Analysis/DataDictionary/SearchBar/SearchBar.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe('SearchBar', () => {
searchInputValue={searchInputValue}
setSearchInputValue={setSearchInputValue}
/>
</table>
</table>,
);

// Simulate input change event
Expand All @@ -37,11 +37,8 @@ describe('SearchBar', () => {
fireEvent.keyPress(input, { key: 'Enter' });

expect(setData).toHaveBeenCalledTimes(1);
const filteredData = TableData.filter((item) => {
return Object.values(item).some((value) =>
value?.toString()?.toLowerCase()?.includes('do')
);
});
const filteredData = TableData.filter((item) => Object.values(item).some((value) => value?.toString()?.toLowerCase()?.includes('do'),
));
expect(setData).toHaveBeenLastCalledWith(filteredData);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@ import {
checkIfHiddenCellsContainSearchTerm,
} from './CheckSearchTermUtils';
import TableData from '../TestData/TableData';
import { IRowData } from '../Interfaces/Interfaces';

const rowObject: any = TableData.data[0];
const impossibleSearchInputValue = 'ThisStringIsTooLongTooHaveBeenGeneratedByTheTestDataGenerator';

describe('checkIfHiddenCellsContainSearchTerm', () => {
it(`should return search-highlight if the row object contains the given
searchInputValue in any of its hidden cells`, () => {
const searchInputValue = TableData.data[0].valueSummary[0].name;
const searchInputValue = TableData.data[0].valueSummary[0].personCount.toString();
expect(
checkIfHiddenCellsContainSearchTerm(rowObject, searchInputValue),
).toBe('search-highlight');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import React from 'react';
import { render, screen } from '@testing-library/react';
import { render } from '@testing-library/react';
import '@testing-library/jest-dom/extend-expect';
import NonNumericDetailsTable from './NonNumericDetailsTable';
import TableData from '../../TestData/TableData';

const rowObject = {
valueSummary: [
Expand Down

0 comments on commit 53d5a16

Please sign in to comment.