From 773c4d491fdb5a6b228165e3ff2f62db7c1f2237 Mon Sep 17 00:00:00 2001 From: Lisa Knox Date: Wed, 13 Sep 2023 14:16:05 -0400 Subject: [PATCH] 15768: last test Arvados-DCO-1.1-Signed-off-by: Lisa Knox --- .../data-explorer/data-explorer.test.tsx | 84 +++++++++++-------- 1 file changed, 48 insertions(+), 36 deletions(-) diff --git a/src/components/data-explorer/data-explorer.test.tsx b/src/components/data-explorer/data-explorer.test.tsx index dc7e8725..4ba0eef9 100644 --- a/src/components/data-explorer/data-explorer.test.tsx +++ b/src/components/data-explorer/data-explorer.test.tsx @@ -4,29 +4,31 @@ import React from "react"; import { configure, mount } from "enzyme"; -import Adapter from 'enzyme-adapter-react-16'; +import Adapter from "enzyme-adapter-react-16"; -import { DataExplorer } from "./data-explorer"; +import { DataExplorer } from "./data-explorer"; //here import { ColumnSelector } from "../column-selector/column-selector"; import { DataTable, DataTableFetchMode } from "../data-table/data-table"; import { SearchInput } from "../search-input/search-input"; import { TablePagination } from "@material-ui/core"; -import { ProjectIcon } from '../icon/icon'; -import { SortDirection } from '../data-table/data-column'; +import { ProjectIcon } from "../icon/icon"; +import { SortDirection } from "../data-table/data-column"; configure({ adapter: new Adapter() }); describe("", () => { - it("communicates with ", () => { const onSearch = jest.fn(); const onSetColumns = jest.fn(); - const dataExplorer = mount(); + const dataExplorer = mount( + + ); expect(dataExplorer.find(SearchInput).prop("value")).toEqual("search value"); dataExplorer.find(SearchInput).prop("onSearch")("new value"); expect(onSearch).toHaveBeenCalledWith("new value"); @@ -36,12 +38,15 @@ describe("", () => { const onColumnToggle = jest.fn(); const onSetColumns = jest.fn(); const columns = [{ name: "Column 1", render: jest.fn(), selected: true, configurable: true, sortDirection: SortDirection.ASC, filters: {} }]; - const dataExplorer = mount(); + const dataExplorer = mount( + + ); expect(dataExplorer.find(ColumnSelector).prop("columns")).toBe(columns); dataExplorer.find(ColumnSelector).prop("onColumnToggle")("columns"); expect(onColumnToggle).toHaveBeenCalledWith("columns"); @@ -54,15 +59,18 @@ describe("", () => { const onSetColumns = jest.fn(); const columns = [{ name: "Column 1", render: jest.fn(), selected: true, configurable: true, sortDirection: SortDirection.ASC, filters: {} }]; const items = [{ name: "item 1" }]; - const dataExplorer = mount(); - expect(dataExplorer.find(DataTable).prop("columns").slice(0, -1)).toEqual(columns); + const dataExplorer = mount( + + ); + expect(dataExplorer.find(DataTable).prop("columns").slice(1, 2)).toEqual(columns); expect(dataExplorer.find(DataTable).prop("items")).toBe(items); dataExplorer.find(DataTable).prop("onRowClick")("event", "rowClick"); dataExplorer.find(DataTable).prop("onFiltersChange")("filtersChange"); @@ -76,14 +84,17 @@ describe("", () => { const onChangePage = jest.fn(); const onChangeRowsPerPage = jest.fn(); const onSetColumns = jest.fn(); - const dataExplorer = mount(); + const dataExplorer = mount( + + ); expect(dataExplorer.find(TablePagination).prop("page")).toEqual(10); expect(dataExplorer.find(TablePagination).prop("rowsPerPage")).toEqual(50); dataExplorer.find(TablePagination).prop("onChangePage")(undefined, 6); @@ -115,6 +126,7 @@ const mockDataExplorerProps = () => ({ defaultIcon: ProjectIcon, onSetColumns: jest.fn(), onLoadMore: jest.fn(), - defaultMessages: ['testing'], - contextMenuColumn: true + defaultMessages: ["testing"], + contextMenuColumn: true, + setCheckedListOnStore: jest.fn(), }); -- 2.39.5