Skip to content

Commit

Permalink
fix: Column value is row.props.[prop] not row.[prop]
Browse files Browse the repository at this point in the history
Also update pagination to 20 instead of 25
  • Loading branch information
amattu2 committed Mar 22, 2024
1 parent c4a5a08 commit fd00371
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
14 changes: 8 additions & 6 deletions src/content/dataSubmissions/DataContent.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ describe("DataContent > Table", () => {

const stats: SubmissionStatistic[] = [{ ...baseSubmissionStatistic, nodeName: "example-node", total: 1 }];

const { getByTestId } = render(
const { getByTestId, getByText } = render(
<TestParent mocks={mocks}>
<DataContent submissionId={submissionID} statistics={stats} />
</TestParent>
Expand All @@ -212,6 +212,9 @@ describe("DataContent > Table", () => {
expect(getByTestId("generic-table-header-col.1")).toBeInTheDocument();
expect(getByTestId("generic-table-header-col.2")).toBeInTheDocument();
expect(getByTestId("generic-table-header-col.3")).toBeInTheDocument();
expect(getByText("value-1")).toBeInTheDocument();
expect(getByText("value-2")).toBeInTheDocument();
expect(getByText("value-3")).toBeInTheDocument();
});
});

Expand Down Expand Up @@ -250,18 +253,19 @@ describe("DataContent > Table", () => {

const stats: SubmissionStatistic[] = [{ ...baseSubmissionStatistic, nodeName: "example-node", total: 1 }];

const { getByTestId } = render(
const { getByTestId, getByText } = render(
<TestParent mocks={mocks}>
<DataContent submissionId={submissionID} statistics={stats} />
</TestParent>
);

await waitFor(() => {
expect(() => getByTestId("generic-table-header-bad-column")).toThrow();
expect(() => getByText("bad-column")).toThrow();
});
});

it("should have a default pagination count of 25 rows per page", async () => {
it("should have a default pagination count of 20 rows per page", async () => {
const submissionID = "example-pagination-default-test-id";

const mocks: MockedResponse<GetSubmissionNodesResp>[] = [{
Expand Down Expand Up @@ -295,9 +299,7 @@ describe("DataContent > Table", () => {
);

await waitFor(() => {
// TODO: this matches current requirements but it should be 20
// if the reqs of 25 is correct, need to update the test queries above
expect(getByTestId("generic-table-rows-per-page")).toHaveValue("25");
expect(getByTestId("generic-table-rows-per-page")).toHaveValue("20");
});
});
});
2 changes: 1 addition & 1 deletion src/content/dataSubmissions/DataContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ const DataContent: FC<Props> = ({ submissionId, statistics }) => {
})));
setColumns(d.getSubmissionNodes.properties.map((prop) => ({
label: prop,
renderValue: (d) => d?.[prop] || "",
renderValue: (d) => d?.props?.[prop] || "",
field: prop as keyof T, // TODO: fix this hack
default: true
})));
Expand Down

0 comments on commit fd00371

Please sign in to comment.