Skip to content

Commit

Permalink
fix BaseTable.test.jsx
Browse files Browse the repository at this point in the history
Signed-off-by: Dennis Adjei-Baah <dennis@buoyant.io>
  • Loading branch information
Dennis Adjei-Baah committed Jun 18, 2021
1 parent fb57142 commit 2c32239
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions web/app/js/components/BaseTable.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import _merge from 'lodash/merge';
import ApiHelpers from './util/ApiHelpers.jsx';
import BaseTable from './BaseTable.jsx';
import TableBody from '@material-ui/core/TableBody';
import FilterListIcon from '@material-ui/icons/FilterList';
import TableRow from '@material-ui/core/TableRow';
import { routerWrap } from '../../test/testHelpers.jsx';
import { mount } from 'enzyme';
Expand Down Expand Up @@ -30,7 +31,7 @@ describe("Tests for <BaseTable>", () => {
deployment: "authors",
namespace: "default",
key: "default-deployment-authors",
pods: {totalPods: "1", meshedPods: "1"}
pods: { totalPods: "1", meshedPods: "1" }
}],
tableColumns: tableColumns,
});
Expand All @@ -51,13 +52,13 @@ describe("Tests for <BaseTable>", () => {
deployment: "authors",
namespace: "default",
key: "default-deployment-authors",
pods: {totalPods: "1", meshedPods: "1"}
pods: { totalPods: "1", meshedPods: "1" }
},
{
deployment: "books",
namespace: "default",
key: "default-deployment-books",
pods: {totalPods: "2", meshedPods: "1"}
pods: { totalPods: "2", meshedPods: "1" }
}],
tableColumns: tableColumns,
enableFilter: true
Expand Down Expand Up @@ -91,13 +92,13 @@ describe("Tests for <BaseTable>", () => {
deployment: "authors",
namespace: "default",
key: "default-deployment-authors",
pods: {totalPods: "1", meshedPods: "1"}
pods: { totalPods: "1", meshedPods: "1" }
},
{
deployment: "books",
namespace: "default",
key: "default-deployment-books",
pods: {totalPods: "2", meshedPods: "1"}
pods: { totalPods: "2", meshedPods: "1" }
}],
tableColumns: tableColumns,
enableFilter: true
Expand All @@ -107,14 +108,14 @@ describe("Tests for <BaseTable>", () => {
const table = component.dive();
expect(table.find(TableBody).find(TableRow)).toHaveLength(2);
const enableFilter = component.prop("enableFilter");
const filterIcon = table.find("FilterListIcon");
const filterIcon = table.find(FilterListIcon);
expect(enableFilter).toEqual(true);
expect(filterIcon).toHaveLength(1);
expect(filterIcon).toBeDefined();

filterIcon.simulate("click");
setTimeout(() => {
const input = table.find("input");
input.simulate("change", {target: {value: "authors"}});
input.simulate("change", { target: { value: "authors" } });
expect(table.html()).not.toContain('books');
expect(table.html()).toContain('authors');
expect(table.find(TableBody).find(TableRow)).toHaveLength(1);
Expand Down

0 comments on commit 2c32239

Please sign in to comment.