Skip to content

Commit

Permalink
refactor: linting #4102
Browse files Browse the repository at this point in the history
  • Loading branch information
MillenniumFalconMechanic committed Jan 30, 2025
1 parent 479ab18 commit 7080737
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 40 deletions.
2 changes: 1 addition & 1 deletion e2e/anvil/anvil-dataset.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ describe.parallel("Dataset", () => {
test("displays request access button", async ({ page }) => {
await goToDataset(page, CHIP_TEXT_ACCESS_REQUIRED);

// Confirm export button is visible.
// Confirm request access button is visible.
const exportButton = getLinkWithText(page, BUTTON_TEXT_REQUEST_ACCESS);
await expect(exportButton).toBeVisible();
});
Expand Down
15 changes: 0 additions & 15 deletions e2e/testFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -800,21 +800,6 @@ export async function testDeselectFiltersThroughSearchBar(
}
}

// /**
// * Get the first link to a backpage with specified backpage access
// * @param page - a Playright page locator
// * @param access - the string denoting the level of access desired
// * @returns a Playwright locator object to the first link to a backpage with the specified access
// */
// const getBackpageLinkLocatorByAccess = (page: Page, access: string): Locator =>
// page
// .getByRole("row")
// .filter({ has: page.getByRole("cell", { name: access }) })
// .first()
// .getByRole("cell")
// .first()
// .getByRole("link");

/**
* Make an export request that leaves only the minimal number of checkboxes selected
* @param page - a Playwright page object
Expand Down
42 changes: 18 additions & 24 deletions pages/[entityListType]/[...params].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,41 +91,35 @@ function isOverride(override: Override): boolean {
}

/**
* Determine if the current view is choose export.
* Check if the current view matches the expected export path segment.
* @param query - The current query object.
* @param expectedIndex - The expected index for the parameter length check.
* @returns True if the view matches the expected export criteria.
*/
function isExportView(query: ParsedUrlQuery, expectedIndex: number): boolean {
return (
!!query.params &&
query.params.length === expectedIndex + 1 &&
query.params[PARAMS_INDEX_TAB] === "export"
);
}

/**
* Determine if the current view is choose export method.
* @param query - The current query object.
* @returns True if the current view is choose export.
*/
function isChooseExportView(query: ParsedUrlQuery): boolean {
// Must have query params for export view.
if (!query.params) {
return false;
}
// Must have correct number of params for export view.
if (query.params.length !== PARAMS_INDEX_TAB + 1) {
return false;
}
// Must have export param.
const exportPathSegment = query.params[PARAMS_INDEX_TAB];
return !!exportPathSegment && exportPathSegment === "export";
return isExportView(query, PARAMS_INDEX_TAB);
}

/**
* Determine if the current view is an export method.
* Determine if the current view is an export method (e.g. file manifest or Terra).
* @param query - The current query object.
* @returns True if the current view is an export method.
*/
function isExportMethodView(query: ParsedUrlQuery): boolean {
// Must have query params for export method view.
if (!query.params) {
return false;
}
// Must have correct number of params for export method view.
if (query.params.length !== PARAMS_INDEX_EXPORT_METHOD + 1) {
return false;
}
// Must have export param.
const exportPathSegment = query.params[PARAMS_INDEX_TAB];
return !!exportPathSegment && exportPathSegment === "export";
return isExportView(query, PARAMS_INDEX_EXPORT_METHOD);
}

/**
Expand Down

0 comments on commit 7080737

Please sign in to comment.