Skip to content

Commit

Permalink
[#1028] fix: remove incorrectly appended filter yourself to drep dire…
Browse files Browse the repository at this point in the history
…ctory
  • Loading branch information
MSzalowski committed May 15, 2024
1 parent 84cd7bb commit 348ece0
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ changes.
- Fix all the existing eslint errors [Issue 514](https://github.com/IntersectMBO/govtool/issues/514)
- Fix all the existing typescript errors [Issue 514](https://github.com/IntersectMBO/govtool/issues/514)
- Fix endless spinner on a dashboard [Issue 539](https://github.com/IntersectMBO/govtool/issues/539)
- Remove wrongly appended `Yourself` filter on DRep Directory [Issue 1028](https://github.com/IntersectMBO/govtool/issues/1028)

### Changed

Expand Down
27 changes: 27 additions & 0 deletions govtool/frontend/src/consts/dRepDirectory/filters.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { DREP_DIRECTORY_FILTERS } from "./filters";

describe("DREP_DIRECTORY_FILTERS", () => {
it("should exclude 'Yourself' from filters", () => {
// Arrange
const expectedFilters = [
{
key: "Active",
label: "Active",
},
{
key: "Inactive",
label: "Inactive",
},
{
key: "Retired",
label: "Retired",
},
];

// Act
const actualFilters = DREP_DIRECTORY_FILTERS;

// Assert
expect(actualFilters).toEqual(expectedFilters);
});
});
11 changes: 7 additions & 4 deletions govtool/frontend/src/consts/dRepDirectory/filters.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { DRepStatus } from "@/models";

export const DREP_DIRECTORY_FILTERS = Object.values(DRepStatus).map((status) => ({
key: status,
label: status,
}));
export const DREP_DIRECTORY_FILTERS = Object.values(DRepStatus)
// `Yourself` should be excluded from filters
.filter((status) => status !== DRepStatus.Yourself)
.map((status) => ({
key: status,
label: status,
}));

0 comments on commit 348ece0

Please sign in to comment.