Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync releases #531

Merged
merged 39 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
fa90a41
Updated listSubmissions query and response type
Alejandro-Vega Oct 31, 2024
b9b5c71
Update filters to use org from listSubmissions API instead of retriev…
Alejandro-Vega Oct 31, 2024
4a61edf
Update tests for filters
Alejandro-Vega Oct 31, 2024
9eae029
Add additional tests
Alejandro-Vega Oct 31, 2024
aacfdad
Synchronize CDE parsing logic
amattu2 Nov 1, 2024
1aa6002
Merge branch '3.1.0' into CRDCDH-1738-org-dropdown
Alejandro-Vega Nov 4, 2024
607acf4
Sort orgs by name
Alejandro-Vega Nov 4, 2024
5698b86
Remove any mention of orgs from Data Submission List page
Alejandro-Vega Nov 4, 2024
26265ad
Fix collaborators property height
Alejandro-Vega Nov 4, 2024
8b6a6d9
Fixed resetting table page and filters race condition when page is no…
Alejandro-Vega Nov 5, 2024
2d9e417
Remove useEffect and replace with linear logic
Alejandro-Vega Nov 5, 2024
cbbfa1d
Remove unused import
Alejandro-Vega Nov 5, 2024
ad31897
Update additional state on refetch after creating a new submission
Alejandro-Vega Nov 5, 2024
1a405f6
feat: Use CDE Origin from MDF
amattu2 Nov 5, 2024
9d3bf8f
fix: Remove `CDEOrigin` from input
amattu2 Nov 5, 2024
2eb7c13
Undo previous change, didn't fix bug
Alejandro-Vega Nov 5, 2024
d32e03b
Remove unused imports
Alejandro-Vega Nov 5, 2024
efdb01f
Bandage fix for debouncing specific dropdowns
Alejandro-Vega Nov 5, 2024
b12f2ba
Add waitFor to tests
Alejandro-Vega Nov 5, 2024
43e9148
Merge pull request #521 from CBIIT/NO-ISSUE/CDE-Parsing-Logic-Sync
Alejandro-Vega Nov 5, 2024
0323702
Merge branch '3.1.0' into CRDCDH-1738-org-dropdown
Alejandro-Vega Nov 5, 2024
99a458b
Update org type
Alejandro-Vega Nov 5, 2024
5378f55
Merge pull request #516 from CBIIT/CRDCDH-1738-org-dropdown
Alejandro-Vega Nov 5, 2024
21be73e
Restyle metric field per UX
amattu2 Nov 7, 2024
3aae75a
fix: Node labels overlapping
amattu2 Nov 8, 2024
d6f6d15
CRDCDH-1977 Fix Model Navigator crash and add test coverage
amattu2 Nov 8, 2024
b8cd159
fix: Focused input missing border radius
amattu2 Nov 8, 2024
aa06d99
Merge pull request #526 from CBIIT/CRDCDH-1976
Alejandro-Vega Nov 8, 2024
c706dcd
Merge branch '3.1.0' into CRDCDH-1428
Alejandro-Vega Nov 8, 2024
573ba6a
Merge pull request #525 from CBIIT/CRDCDH-1428
Alejandro-Vega Nov 8, 2024
314c75b
Merge branch '3.1.0' into CRDCDH-1977
amattu2 Nov 12, 2024
b9deca9
fix: Remove directly imported CSS
amattu2 Nov 12, 2024
a9fa267
Add test coverage
amattu2 Nov 12, 2024
c3fe27b
fix: Name casing
amattu2 Nov 12, 2024
f3892a6
Delete src/components/ScrollButton/ScrollbuttonView.test.tsx
amattu2 Nov 12, 2024
4e03863
Merge pull request #530 from CBIIT/fix-css-import
amattu2 Nov 12, 2024
1fed50c
Merge pull request #528 from CBIIT/CRDCDH-1977
amattu2 Nov 12, 2024
1f17e42
Merge branch '3.1.0' into sync-3.2.0-3.1.0
amattu2 Nov 13, 2024
7282f07
Migrate 3.1.0 `wrapperSx` prop change
amattu2 Nov 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions src/assets/icons/Scroll_to_top.svg

This file was deleted.

142 changes: 112 additions & 30 deletions src/components/DataSubmissions/DataSubmissionListFilters.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
ContextState as AuthContextState,
Status as AuthContextStatus,
} from "../Contexts/AuthContext";
import { useOrganizationListContext } from "../Contexts/OrganizationListContext";
import { Column } from "../GenericTable";
import { ListSubmissionsResp } from "../../graphql";

Expand Down Expand Up @@ -82,28 +81,15 @@ describe("DataSubmissionListFilters Component", () => {

const submitterNames = ["Submitter1", "Submitter2"];
const dataCommons = ["DataCommon1", "DataCommon2"];
const organizations: Organization[] = [
{ _id: "Org1", name: "Organization 1" } as Organization,
{ _id: "Org2", name: "Organization 2" } as Organization,
];
const columnVisibilityModel = { name: true, status: true };

const mockOnChange = jest.fn();
const mockOnColumnVisibilityModelChange = jest.fn();

beforeEach(() => {
// Set up default mock for useOrganizationListContext
(useOrganizationListContext as jest.Mock).mockReturnValue({
activeOrganizations: [
{ _id: "Org1", name: "Organization 1" },
{ _id: "Org2", name: "Organization 2" },
],
status: "LOADED",
data: {
activeOrganizations: [
{ _id: "Org1", name: "Organization 1" },
{ _id: "Org2", name: "Organization 2" },
],
},
});
});

afterEach(() => {
jest.clearAllMocks();
jest.useRealTimers();
Expand All @@ -114,6 +100,7 @@ describe("DataSubmissionListFilters Component", () => {
<TestParent>
<DataSubmissionListFilters
columns={columns}
organizations={organizations}
submitterNames={submitterNames}
dataCommons={dataCommons}
columnVisibilityModel={columnVisibilityModel}
Expand All @@ -133,6 +120,7 @@ describe("DataSubmissionListFilters Component", () => {
<TestParent userRole="Admin">
<DataSubmissionListFilters
columns={columns}
organizations={organizations}
submitterNames={submitterNames}
dataCommons={dataCommons}
columnVisibilityModel={columnVisibilityModel}
Expand Down Expand Up @@ -162,6 +150,7 @@ describe("DataSubmissionListFilters Component", () => {
<TestParent>
<DataSubmissionListFilters
columns={columns}
organizations={organizations}
submitterNames={submitterNames}
dataCommons={dataCommons}
columnVisibilityModel={columnVisibilityModel}
Expand Down Expand Up @@ -189,6 +178,7 @@ describe("DataSubmissionListFilters Component", () => {
<TestParent userRole="Admin">
<DataSubmissionListFilters
columns={columns}
organizations={organizations}
submitterNames={submitterNames}
dataCommons={dataCommons}
columnVisibilityModel={columnVisibilityModel}
Expand Down Expand Up @@ -221,11 +211,12 @@ describe("DataSubmissionListFilters Component", () => {
});
});

it("prevents non-admin users from changing the organization select", async () => {
it("allows non-admin users to select an organization", async () => {
const { getByTestId } = render(
<TestParent userRole="Submitter">
<DataSubmissionListFilters
columns={columns}
organizations={organizations}
submitterNames={submitterNames}
dataCommons={dataCommons}
columnVisibilityModel={columnVisibilityModel}
Expand All @@ -242,14 +233,15 @@ describe("DataSubmissionListFilters Component", () => {
const organizationSelectInput = getByTestId("organization-select");

const button = within(organizationSelectInput).getByRole("button");
expect(button).toHaveClass("Mui-readOnly");
expect(button).not.toHaveClass("Mui-readOnly");
});

it("resets all filters and clears URL searchParams when reset button is clicked", async () => {
const { getByTestId, getByRole } = render(
<TestParent userRole="Admin">
<DataSubmissionListFilters
columns={columns}
organizations={organizations}
submitterNames={submitterNames}
dataCommons={dataCommons}
columnVisibilityModel={columnVisibilityModel}
Expand Down Expand Up @@ -377,6 +369,7 @@ describe("DataSubmissionListFilters Component", () => {
<TestParent userRole="Admin">
<DataSubmissionListFilters
columns={columns}
organizations={organizations}
submitterNames={submitterNames}
dataCommons={dataCommons}
columnVisibilityModel={columnVisibilityModel}
Expand Down Expand Up @@ -404,6 +397,7 @@ describe("DataSubmissionListFilters Component", () => {
<TestParent userRole="Admin">
<DataSubmissionListFilters
columns={columns}
organizations={organizations}
submitterNames={submitterNames}
dataCommons={dataCommons}
columnVisibilityModel={columnVisibilityModel}
Expand Down Expand Up @@ -439,6 +433,7 @@ describe("DataSubmissionListFilters Component", () => {
<TestParent userRole="Admin">
<DataSubmissionListFilters
columns={columns}
organizations={organizations}
submitterNames={submitterNames}
dataCommons={dataCommons}
columnVisibilityModel={columnVisibilityModel}
Expand Down Expand Up @@ -468,6 +463,7 @@ describe("DataSubmissionListFilters Component", () => {
<TestParent userRole="Admin">
<DataSubmissionListFilters
columns={columns}
organizations={organizations}
submitterNames={submitterNames}
dataCommons={dataCommons}
columnVisibilityModel={columnVisibilityModel}
Expand Down Expand Up @@ -503,6 +499,7 @@ describe("DataSubmissionListFilters Component", () => {
<TestParent userRole="Admin">
<DataSubmissionListFilters
columns={columns}
organizations={organizations}
submitterNames={submitterNames}
dataCommons={dataCommons}
columnVisibilityModel={columnVisibilityModel}
Expand Down Expand Up @@ -540,6 +537,7 @@ describe("DataSubmissionListFilters Component", () => {
<TestParent userRole="Admin">
<DataSubmissionListFilters
columns={columns}
organizations={organizations}
submitterNames={submitterNames}
dataCommons={dataCommons}
columnVisibilityModel={columnVisibilityModel}
Expand Down Expand Up @@ -581,6 +579,7 @@ describe("DataSubmissionListFilters Component", () => {
<TestParent userRole="Admin">
<DataSubmissionListFilters
columns={columns}
organizations={organizations}
submitterNames={submitterNames}
dataCommons={dataCommons}
columnVisibilityModel={columnVisibilityModel}
Expand Down Expand Up @@ -624,6 +623,7 @@ describe("DataSubmissionListFilters Component", () => {
<TestParent initialEntries={initialEntries} userRole="Admin">
<DataSubmissionListFilters
columns={columns}
organizations={organizations}
submitterNames={submitterNames}
dataCommons={dataCommons}
columnVisibilityModel={columnVisibilityModel}
Expand Down Expand Up @@ -667,6 +667,7 @@ describe("DataSubmissionListFilters Component", () => {
<TestParent initialEntries={initialEntries} userRole="Admin">
<DataSubmissionListFilters
columns={columns}
organizations={organizations}
submitterNames={submitterNames}
dataCommons={dataCommons}
columnVisibilityModel={columnVisibilityModel}
Expand Down Expand Up @@ -707,6 +708,7 @@ describe("DataSubmissionListFilters Component", () => {
<TestParent initialEntries={initialEntries} userRole="Admin">
<DataSubmissionListFilters
columns={columns}
organizations={organizations}
submitterNames={submitterNames}
dataCommons={dataCommons}
columnVisibilityModel={columnVisibilityModel}
Expand Down Expand Up @@ -739,6 +741,7 @@ describe("DataSubmissionListFilters Component", () => {
<TestParent initialEntries={initialEntries} userRole="Admin">
<DataSubmissionListFilters
columns={columns}
organizations={organizations}
submitterNames={submitterNames}
dataCommons={[]} // Empty dataCommons
columnVisibilityModel={columnVisibilityModel}
Expand Down Expand Up @@ -782,6 +785,7 @@ describe("DataSubmissionListFilters Component", () => {
<TestParent>
<DataSubmissionListFilters
columns={columns}
organizations={organizations}
submitterNames={submitterNames}
dataCommons={["DataCommon1", "DataCommon2"]} // Non-empty dataCommons
columnVisibilityModel={columnVisibilityModel}
Expand Down Expand Up @@ -809,13 +813,12 @@ describe("DataSubmissionListFilters Component", () => {

await waitFor(() => {
expect(getByTestId("data-commons-select-input")).toHaveValue("DataCommon1");
expect(mockOnChange).toHaveBeenCalledWith(
expect.objectContaining({
dataCommons: "DataCommon1",
})
);
});

expect(mockOnChange).toHaveBeenCalledWith(
expect.objectContaining({
dataCommons: "DataCommon1",
})
);
});

it("sets submitterNames select to 'All' when submitterNames prop is empty", async () => {
Expand All @@ -826,6 +829,7 @@ describe("DataSubmissionListFilters Component", () => {
<TestParent>
<DataSubmissionListFilters
columns={columns}
organizations={organizations}
submitterNames={[]} // Empty submitterNames
dataCommons={dataCommons}
columnVisibilityModel={columnVisibilityModel}
Expand Down Expand Up @@ -863,6 +867,7 @@ describe("DataSubmissionListFilters Component", () => {
<TestParent>
<DataSubmissionListFilters
columns={columns}
organizations={organizations}
submitterNames={["Submitter1", "Submitter2"]} // Non-empty submitterNames
dataCommons={dataCommons}
columnVisibilityModel={columnVisibilityModel}
Expand Down Expand Up @@ -890,12 +895,89 @@ describe("DataSubmissionListFilters Component", () => {

await waitFor(() => {
expect(getByTestId("submitter-name-select-input")).toHaveValue("Submitter1");
expect(mockOnChange).toHaveBeenCalledWith(
expect.objectContaining({
submitterName: "Submitter1",
})
);
});
});

expect(mockOnChange).toHaveBeenCalledWith(
expect.objectContaining({
submitterName: "Submitter1",
})
it("sets organization select to 'All' when organizations prop is empty", async () => {
const mockOnChange = jest.fn();
const mockOnColumnVisibilityModelChange = jest.fn();

const { getByTestId, getByRole } = render(
<TestParent>
<DataSubmissionListFilters
columns={columns}
organizations={[]}
submitterNames={submitterNames}
dataCommons={dataCommons}
columnVisibilityModel={columnVisibilityModel}
onColumnVisibilityModelChange={mockOnColumnVisibilityModelChange}
onChange={mockOnChange}
/>
</TestParent>
);

await waitFor(() => {
expect(getByTestId("organization-select-input")).toHaveValue("All");
});

const organizationSelect = within(getByTestId("organization-select")).getByRole("button");
userEvent.click(organizationSelect);

const organizationList = within(getByRole("listbox", { hidden: true }));

await waitFor(() => {
expect(organizationList.getByTestId("organization-option-All")).toBeInTheDocument();
expect(organizationList.queryByTestId("organization-option-Org1")).not.toBeInTheDocument();
expect(organizationList.queryByTestId("organization-option-Org2")).not.toBeInTheDocument();
});
});

it("sets organization select to field.value when organizations prop is non-empty", async () => {
const mockOnChange = jest.fn();
const mockOnColumnVisibilityModelChange = jest.fn();

const { getByTestId, getByRole } = render(
<TestParent>
<DataSubmissionListFilters
columns={columns}
organizations={organizations}
submitterNames={submitterNames}
dataCommons={dataCommons}
columnVisibilityModel={columnVisibilityModel}
onColumnVisibilityModelChange={mockOnColumnVisibilityModelChange}
onChange={mockOnChange}
/>
</TestParent>
);

await waitFor(() => {
expect(getByTestId("organization-select-input")).toHaveValue("All");
});

const organizationSelect = within(getByTestId("organization-select")).getByRole("button");
userEvent.click(organizationSelect);

const organizationList = within(getByRole("listbox", { hidden: true }));

await waitFor(() => {
expect(organizationList.getByTestId("organization-option-Org1")).toBeInTheDocument();
expect(organizationList.getByTestId("organization-option-Org2")).toBeInTheDocument();
});

userEvent.click(getByTestId("organization-option-Org1"));

await waitFor(() => {
expect(getByTestId("organization-select-input")).toHaveValue("Org1");
expect(mockOnChange).toHaveBeenCalledWith(
expect.objectContaining({
organization: "Org1",
})
);
});
});
});
Loading