Skip to content

Commit

Permalink
chore: apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
BCerki committed Dec 17, 2024
1 parent e7ac7d8 commit ea18847
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -224,11 +224,11 @@ describe("OperationsDataGrid component", () => {

expect(operationInfoLinks[0]).toHaveAttribute(
"href",
"../administration/operations/1?operations_title=Operation 1",
"/administration/operations/1?operations_title=Operation 1",
);
expect(operationInfoLinks[1]).toHaveAttribute(
"href",
"../administration/operations/2?operations_title=Operation 2",
"/administration/operations/2?operations_title=Operation 2",
);
});

Expand All @@ -241,14 +241,14 @@ describe("OperationsDataGrid component", () => {
screen.getByRole("link", {
name: /Start registration/i,
}),
).toHaveAttribute("href", "../registration/register-an-operation");
).toHaveAttribute("href", "/registration/register-an-operation");
expect(
screen.getByRole("link", {
name: /view operation/i,
}),
).toHaveAttribute(
"href",
"../administration/operations/2?operations_title=Operation 2",
"/administration/operations/2?operations_title=Operation 2",
);

const continueRegistrationlinks = screen.getAllByRole("link", {
Expand All @@ -257,11 +257,11 @@ describe("OperationsDataGrid component", () => {

expect(continueRegistrationlinks[0]).toHaveAttribute(
"href",
"../registration/register-an-operation/1/1",
"/registration/register-an-operation/1/1",
);
expect(continueRegistrationlinks[1]).toHaveAttribute(
"href",
"../registration/register-an-operation/4/1",
"/registration/register-an-operation/4/1",
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ import { OperationStatus } from "@bciers/utils/src/enums";
const OperationsActionCell = (isInternalUser: boolean) => {
const renderCell = (params: GridRenderCellParams) => {
let actionText = "View Operation";
let url = `../administration/operations/${params.row.id}?operations_title=${params.row.name}`;
let url = `/administration/operations/${params.row.id}?operations_title=${params.row.name}`;
if (!isInternalUser) {
switch (params.row.status) {
case OperationStatus.NOT_STARTED:
actionText = "Start Registration";
url = "../registration/register-an-operation";
url = "/registration/register-an-operation";
break;
case OperationStatus.DRAFT:
actionText = "Continue Registration";
url = `../registration/register-an-operation/${params.row.id}/1`;
url = `/registration/register-an-operation/${params.row.id}/1`;
break;
}
}
Expand Down

0 comments on commit ea18847

Please sign in to comment.