Skip to content

Commit 7080737

Browse files
refactor: linting #4102
1 parent 479ab18 commit 7080737

File tree

3 files changed

+19
-40
lines changed

3 files changed

+19
-40
lines changed

e2e/anvil/anvil-dataset.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ describe.parallel("Dataset", () => {
2727
test("displays request access button", async ({ page }) => {
2828
await goToDataset(page, CHIP_TEXT_ACCESS_REQUIRED);
2929

30-
// Confirm export button is visible.
30+
// Confirm request access button is visible.
3131
const exportButton = getLinkWithText(page, BUTTON_TEXT_REQUEST_ACCESS);
3232
await expect(exportButton).toBeVisible();
3333
});

e2e/testFunctions.ts

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -800,21 +800,6 @@ export async function testDeselectFiltersThroughSearchBar(
800800
}
801801
}
802802

803-
// /**
804-
// * Get the first link to a backpage with specified backpage access
805-
// * @param page - a Playright page locator
806-
// * @param access - the string denoting the level of access desired
807-
// * @returns a Playwright locator object to the first link to a backpage with the specified access
808-
// */
809-
// const getBackpageLinkLocatorByAccess = (page: Page, access: string): Locator =>
810-
// page
811-
// .getByRole("row")
812-
// .filter({ has: page.getByRole("cell", { name: access }) })
813-
// .first()
814-
// .getByRole("cell")
815-
// .first()
816-
// .getByRole("link");
817-
818803
/**
819804
* Make an export request that leaves only the minimal number of checkboxes selected
820805
* @param page - a Playwright page object

pages/[entityListType]/[...params].tsx

Lines changed: 18 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -91,41 +91,35 @@ function isOverride(override: Override): boolean {
9191
}
9292

9393
/**
94-
* Determine if the current view is choose export.
94+
* Check if the current view matches the expected export path segment.
95+
* @param query - The current query object.
96+
* @param expectedIndex - The expected index for the parameter length check.
97+
* @returns True if the view matches the expected export criteria.
98+
*/
99+
function isExportView(query: ParsedUrlQuery, expectedIndex: number): boolean {
100+
return (
101+
!!query.params &&
102+
query.params.length === expectedIndex + 1 &&
103+
query.params[PARAMS_INDEX_TAB] === "export"
104+
);
105+
}
106+
107+
/**
108+
* Determine if the current view is choose export method.
95109
* @param query - The current query object.
96110
* @returns True if the current view is choose export.
97111
*/
98112
function isChooseExportView(query: ParsedUrlQuery): boolean {
99-
// Must have query params for export view.
100-
if (!query.params) {
101-
return false;
102-
}
103-
// Must have correct number of params for export view.
104-
if (query.params.length !== PARAMS_INDEX_TAB + 1) {
105-
return false;
106-
}
107-
// Must have export param.
108-
const exportPathSegment = query.params[PARAMS_INDEX_TAB];
109-
return !!exportPathSegment && exportPathSegment === "export";
113+
return isExportView(query, PARAMS_INDEX_TAB);
110114
}
111115

112116
/**
113-
* Determine if the current view is an export method.
117+
* Determine if the current view is an export method (e.g. file manifest or Terra).
114118
* @param query - The current query object.
115119
* @returns True if the current view is an export method.
116120
*/
117121
function isExportMethodView(query: ParsedUrlQuery): boolean {
118-
// Must have query params for export method view.
119-
if (!query.params) {
120-
return false;
121-
}
122-
// Must have correct number of params for export method view.
123-
if (query.params.length !== PARAMS_INDEX_EXPORT_METHOD + 1) {
124-
return false;
125-
}
126-
// Must have export param.
127-
const exportPathSegment = query.params[PARAMS_INDEX_TAB];
128-
return !!exportPathSegment && exportPathSegment === "export";
122+
return isExportView(query, PARAMS_INDEX_EXPORT_METHOD);
129123
}
130124

131125
/**

0 commit comments

Comments
 (0)