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

feat(test): tests for Dashboard #1094

Merged
merged 23 commits into from
Feb 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
0ab6241
added tests
thetif Jan 16, 2025
4aac70c
more tests
thetif Jan 16, 2025
e43ec01
Merge branch 'main' of github.com:Enterprise-CMCS/macpro-mako
thetif Jan 16, 2025
cc38ed7
more tests
thetif Jan 16, 2025
ac7a7a4
Merge branch 'main' of github.com:Enterprise-CMCS/macpro-mako
thetif Jan 21, 2025
be67343
Merge branch 'main' of github.com:Enterprise-CMCS/macpro-mako
thetif Jan 24, 2025
b854e1c
Merge branch 'main' of github.com:Enterprise-CMCS/macpro-mako
thetif Jan 27, 2025
8804426
Merge branch 'main' of github.com:Enterprise-CMCS/macpro-mako
thetif Jan 28, 2025
19784ea
Merge branch 'main' of github.com:Enterprise-CMCS/macpro-mako
thetif Jan 29, 2025
343cc78
Merge branch 'main' of github.com:Enterprise-CMCS/macpro-mako
thetif Jan 29, 2025
e0e096c
opensearch component tests
thetif Jan 30, 2025
14d278c
Merge branch 'test-dashboard' of github.com:Enterprise-CMCS/macpro-ma…
thetif Jan 30, 2025
6bf969b
Merge branch 'main' of github.com:Enterprise-CMCS/macpro-mako into te…
thetif Jan 30, 2025
4333859
* adding tests for SpasList
thetif Jan 31, 2025
0f7a7db
Merge branch 'main' of github.com:Enterprise-CMCS/macpro-mako into te…
thetif Jan 31, 2025
cbbc8b5
tests for SpasList
thetif Jan 31, 2025
a8d1a11
fixed failing tests
thetif Jan 31, 2025
e116e5d
Merge branch 'main' of github.com:Enterprise-CMCS/macpro-mako into te…
thetif Jan 31, 2025
c433f7f
Merge branch 'main' of github.com:Enterprise-CMCS/macpro-mako into te…
thetif Feb 3, 2025
ae4379f
Merge branch 'main' of github.com:Enterprise-CMCS/macpro-mako into te…
thetif Feb 3, 2025
029cdd7
more tests
thetif Feb 4, 2025
9afaaa1
Merge branch 'main' of github.com:Enterprise-CMCS/macpro-mako into te…
thetif Feb 4, 2025
320c484
removed debug line, increased test thresholds
thetif Feb 4, 2025
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
3 changes: 3 additions & 0 deletions .github/workflows/pr-coverage-annotation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ jobs:
run-id: ${{ steps.get-run-id.outputs.run-id }}
- name: Test
if: always()
id: test
continue-on-error: true
run: run test --coverage
- name: Report Coverage (compared with Main)
Expand All @@ -44,3 +45,5 @@ jobs:
- name: Report Coverage (only PR)
if: steps.get-main-coverage.conclusion == 'failure' || steps.get-main-coverage.conclusion == 'skipped'
uses: davelosert/vitest-coverage-report-action@v2
outputs:
actualResult: ${{ steps.test.conclusion }}
16 changes: 16 additions & 0 deletions lib/libs/api/package/appk.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ describe("getAppkChildren", () => {

expect(result).toEqual(
expect.objectContaining({
_shards: {
failed: 0,
skipped: 0,
successful: 5,
total: 5,
},
hits: {
total: {
value: 1,
Expand All @@ -35,6 +41,7 @@ describe("getAppkChildren", () => {
_source: {
authority: "1915(c)",
changedDate: "2024-01-01T00:00:00Z",
makoChangedDate: "2024-01-01T00:00:00Z",
title: "Initial release",
seatoolStatus: "Pending",
cmsStatus: "Pending",
Expand All @@ -43,6 +50,8 @@ describe("getAppkChildren", () => {
},
],
},
timed_out: false,
took: 5,
}),
);
});
Expand All @@ -54,6 +63,12 @@ describe("getAppkChildren", () => {

expect(result).toEqual(
expect.objectContaining({
_shards: {
failed: 0,
skipped: 0,
successful: 5,
total: 5,
},
hits: {
total: {
value: 1,
Expand All @@ -64,6 +79,7 @@ describe("getAppkChildren", () => {
{
_source: {
changedDate: "2025-01-08T00:00:00Z",
makoChangedDate: "2025-01-08T00:00:00Z",
title: "Approved release",
cmsStatus: "Approved",
stateStatus: "Approved",
Expand Down
63 changes: 60 additions & 3 deletions mocks/data/items.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import { SEATOOL_STATUS, opensearch } from "shared-types";
import {
opensearch,
statusToDisplayToStateUser,
statusToDisplayToCmsUser,
SEATOOL_STATUS,
} from "shared-types";
import type { TestItemResult } from "../index.d";
import { ATTACHMENT_BUCKET_NAME } from "../consts";

Expand Down Expand Up @@ -43,6 +48,8 @@ const items: Record<string, TestItemResult> = {
_source: {
id: EXISTING_ITEM_ID,
seatoolStatus: SEATOOL_STATUS.APPROVED,
stateStatus: statusToDisplayToStateUser[SEATOOL_STATUS.APPROVED],
cmsStatus: statusToDisplayToCmsUser[SEATOOL_STATUS.APPROVED],
actionType: "New",
},
},
Expand Down Expand Up @@ -90,6 +97,8 @@ const items: Record<string, TestItemResult> = {
submitterEmail: "[email protected]",
id: EXISTING_ITEM_ID,
seatoolStatus: SEATOOL_STATUS.APPROVED,
stateStatus: statusToDisplayToStateUser[SEATOOL_STATUS.APPROVED],
cmsStatus: statusToDisplayToCmsUser[SEATOOL_STATUS.APPROVED],
actionType: "New",
},
},
Expand All @@ -99,6 +108,8 @@ const items: Record<string, TestItemResult> = {
_source: {
id: EXISTING_ITEM_APPROVED_NEW_ID,
seatoolStatus: SEATOOL_STATUS.APPROVED,
stateStatus: statusToDisplayToStateUser[SEATOOL_STATUS.APPROVED],
cmsStatus: statusToDisplayToCmsUser[SEATOOL_STATUS.APPROVED],
actionType: "New",
authority: "1915(b)",
origin: "OneMAC",
Expand All @@ -111,6 +122,8 @@ const items: Record<string, TestItemResult> = {
_source: {
id: VALID_ITEM_EXTENSION_ID,
seatoolStatus: SEATOOL_STATUS.APPROVED,
stateStatus: statusToDisplayToStateUser[SEATOOL_STATUS.APPROVED],
cmsStatus: statusToDisplayToCmsUser[SEATOOL_STATUS.APPROVED],
actionType: "New",
authority: "1915(b)",
origin: "OneMAC",
Expand All @@ -123,6 +136,8 @@ const items: Record<string, TestItemResult> = {
_source: {
id: EXISTING_ITEM_APPROVED_AMEND_ID,
seatoolStatus: SEATOOL_STATUS.APPROVED,
stateStatus: statusToDisplayToStateUser[SEATOOL_STATUS.APPROVED],
cmsStatus: statusToDisplayToCmsUser[SEATOOL_STATUS.APPROVED],
actionType: "Amend",
authority: "1915(b)",
origin: "OneMAC",
Expand All @@ -135,6 +150,8 @@ const items: Record<string, TestItemResult> = {
_source: {
id: EXISTING_ITEM_APPROVED_RENEW_ID,
seatoolStatus: SEATOOL_STATUS.APPROVED,
stateStatus: statusToDisplayToStateUser[SEATOOL_STATUS.APPROVED],
cmsStatus: statusToDisplayToCmsUser[SEATOOL_STATUS.APPROVED],
actionType: "Renew",
authority: "1915(b)",
origin: "OneMAC",
Expand All @@ -147,6 +164,8 @@ const items: Record<string, TestItemResult> = {
_source: {
id: EXISTING_ITEM_PENDING_ID,
seatoolStatus: SEATOOL_STATUS.PENDING,
stateStatus: statusToDisplayToStateUser[SEATOOL_STATUS.PENDING],
cmsStatus: statusToDisplayToCmsUser[SEATOOL_STATUS.PENDING],
actionType: "New",
origin: "SEATool",
state: "MD",
Expand All @@ -158,6 +177,8 @@ const items: Record<string, TestItemResult> = {
_source: {
id: CAPITATED_AMEND_ITEM_ID,
seatoolStatus: SEATOOL_STATUS.PENDING,
stateStatus: statusToDisplayToStateUser[SEATOOL_STATUS.PENDING],
cmsStatus: statusToDisplayToCmsUser[SEATOOL_STATUS.PENDING],
actionType: "New",
origin: "SEATool",
state: "MD",
Expand Down Expand Up @@ -315,10 +336,13 @@ const items: Record<string, TestItemResult> = {
_source: {
id: TEST_ITEM_ID,
seatoolStatus: SEATOOL_STATUS.APPROVED,
stateStatus: statusToDisplayToStateUser[SEATOOL_STATUS.APPROVED],
cmsStatus: statusToDisplayToCmsUser[SEATOOL_STATUS.APPROVED],
actionType: "New",
state: "MD",
origin: "OneMAC",
changedDate: "2024-11-26T18:17:21.557Z",
makoChangedDate: "2024-11-26T18:17:21.557Z",
changelog: [
{
_id: `${TEST_ITEM_ID}-001`,
Expand All @@ -338,10 +362,14 @@ const items: Record<string, TestItemResult> = {
_source: {
id: TEST_SPA_ITEM_ID,
seatoolStatus: SEATOOL_STATUS.APPROVED,
stateStatus: statusToDisplayToStateUser[SEATOOL_STATUS.APPROVED],
cmsStatus: statusToDisplayToCmsUser[SEATOOL_STATUS.APPROVED],
actionType: "New",
state: "MD",
origin: "OneMAC",
submissionDate: "2024-10-27T18:17:21.557Z",
changedDate: "2024-11-26T18:17:21.557Z",
makoChangedDate: "2024-11-26T18:17:21.557Z",
changelog: [
{
_id: `${TEST_SPA_ITEM_ID}-001`,
Expand Down Expand Up @@ -386,10 +414,13 @@ const items: Record<string, TestItemResult> = {
_source: {
id: TEST_SPA_ITEM_TO_SPLIT,
seatoolStatus: SEATOOL_STATUS.APPROVED,
stateStatus: statusToDisplayToStateUser[SEATOOL_STATUS.APPROVED],
cmsStatus: statusToDisplayToCmsUser[SEATOOL_STATUS.APPROVED],
actionType: "New",
state: "MD",
origin: "OneMAC",
changedDate: "2024-11-26T18:17:21.557Z",
makoChangedDate: "2024-11-26T18:17:21.557Z",
changelog: [
{
_id: `${TEST_SPA_ITEM_TO_SPLIT}-001`,
Expand All @@ -409,10 +440,13 @@ const items: Record<string, TestItemResult> = {
_source: {
id: TEST_SPLIT_SPA_ITEM_ID,
seatoolStatus: SEATOOL_STATUS.APPROVED,
stateStatus: statusToDisplayToStateUser[SEATOOL_STATUS.APPROVED],
cmsStatus: statusToDisplayToCmsUser[SEATOOL_STATUS.APPROVED],
actionType: "New",
state: "MD",
origin: "OneMAC",
changedDate: "2024-11-26T18:17:21.557Z",
makoChangedDate: "2024-11-26T18:17:21.557Z",
changelog: [
{
_id: `${TEST_SPLIT_SPA_ITEM_ID}-001`,
Expand All @@ -432,6 +466,8 @@ const items: Record<string, TestItemResult> = {
_source: {
id: EXISTING_ITEM_TEMPORARY_EXTENSION_ID,
seatoolStatus: SEATOOL_STATUS.APPROVED,
stateStatus: statusToDisplayToStateUser[SEATOOL_STATUS.APPROVED],
cmsStatus: statusToDisplayToCmsUser[SEATOOL_STATUS.APPROVED],
actionType: "Extend",
authority: "Medicaid SPA",
changedDate: undefined,
Expand All @@ -445,6 +481,8 @@ const items: Record<string, TestItemResult> = {
_source: {
id: HI_TEST_ITEM_ID,
seatoolStatus: SEATOOL_STATUS.APPROVED,
stateStatus: statusToDisplayToStateUser[SEATOOL_STATUS.APPROVED],
cmsStatus: statusToDisplayToCmsUser[SEATOOL_STATUS.APPROVED],
actionType: "New",
authority: "Medicaid SPA",
state: "HI",
Expand All @@ -457,6 +495,8 @@ const items: Record<string, TestItemResult> = {
_source: {
id: CAPITATED_INITIAL_ITEM_ID,
seatoolStatus: SEATOOL_STATUS.APPROVED,
stateStatus: statusToDisplayToStateUser[SEATOOL_STATUS.APPROVED],
cmsStatus: statusToDisplayToCmsUser[SEATOOL_STATUS.APPROVED],
actionType: "Amend",
authority: "1915(b)",
origin: "OneMAC",
Expand All @@ -479,6 +519,8 @@ const items: Record<string, TestItemResult> = {
_source: {
id: CONTRACTING_INITIAL_ITEM_ID,
seatoolStatus: SEATOOL_STATUS.APPROVED,
stateStatus: statusToDisplayToStateUser[SEATOOL_STATUS.APPROVED],
cmsStatus: statusToDisplayToCmsUser[SEATOOL_STATUS.APPROVED],
actionType: "Amend",
authority: "1915(b)",
origin: "OneMAC",
Expand All @@ -501,6 +543,8 @@ const items: Record<string, TestItemResult> = {
_source: {
id: MISSING_CHANGELOG_ITEM_ID,
seatoolStatus: SEATOOL_STATUS.APPROVED,
stateStatus: statusToDisplayToStateUser[SEATOOL_STATUS.APPROVED],
cmsStatus: statusToDisplayToCmsUser[SEATOOL_STATUS.APPROVED],
actionType: "Amend",
authority: "1915(b)",
origin: "OneMAC",
Expand All @@ -514,6 +558,8 @@ const items: Record<string, TestItemResult> = {
_source: {
id: WITHDRAWN_CHANGELOG_ITEM_ID,
seatoolStatus: SEATOOL_STATUS.WITHDRAWN,
stateStatus: statusToDisplayToStateUser[SEATOOL_STATUS.WITHDRAWN],
cmsStatus: statusToDisplayToCmsUser[SEATOOL_STATUS.WITHDRAWN],
actionType: "Withdrawal",
authority: "CHIP SPA",
state: "MD",
Expand Down Expand Up @@ -660,6 +706,8 @@ const items: Record<string, TestItemResult> = {
_source: {
id: INITIAL_RELEASE_APPK_ITEM_ID,
seatoolStatus: SEATOOL_STATUS.PENDING,
stateStatus: statusToDisplayToStateUser[SEATOOL_STATUS.PENDING],
cmsStatus: statusToDisplayToCmsUser[SEATOOL_STATUS.PENDING],
actionType: "New",
authority: "1915(c)",
state: "MD",
Expand All @@ -669,10 +717,11 @@ const items: Record<string, TestItemResult> = {
_source: {
authority: "1915(c)",
changedDate: "2024-01-01T00:00:00Z",
makoChangedDate: "2024-01-01T00:00:00Z",
title: "Initial release",
seatoolStatus: SEATOOL_STATUS.PENDING,
cmsStatus: "Pending",
stateStatus: "Under Review",
stateStatus: statusToDisplayToStateUser[SEATOOL_STATUS.PENDING],
cmsStatus: statusToDisplayToCmsUser[SEATOOL_STATUS.PENDING],
},
},
],
Expand Down Expand Up @@ -837,6 +886,8 @@ const items: Record<string, TestItemResult> = {
_source: {
id: WITHDRAW_RAI_ITEM_B,
seatoolStatus: SEATOOL_STATUS.PENDING,
stateStatus: statusToDisplayToStateUser[SEATOOL_STATUS.PENDING],
cmsStatus: statusToDisplayToCmsUser[SEATOOL_STATUS.PENDING],
actionType: "respond-to-rai",
authority: "1915(b)",
state: "MD",
Expand All @@ -859,6 +910,8 @@ const items: Record<string, TestItemResult> = {
_source: {
id: WITHDRAW_RAI_ITEM_C,
seatoolStatus: SEATOOL_STATUS.PENDING_RAI,
stateStatus: statusToDisplayToStateUser[SEATOOL_STATUS.PENDING_RAI],
cmsStatus: statusToDisplayToCmsUser[SEATOOL_STATUS.PENDING_RAI],
actionType: "respond-to-rai",
raiRequestedDate: "2024-01-01T00:00:00.000Z",
authority: "1915(c)",
Expand Down Expand Up @@ -903,6 +956,8 @@ const items: Record<string, TestItemResult> = {
_source: {
id: EXISTING_ITEM_APPROVED_APPK_ITEM_ID,
seatoolStatus: SEATOOL_STATUS.APPROVED,
stateStatus: statusToDisplayToStateUser[SEATOOL_STATUS.APPROVED],
cmsStatus: statusToDisplayToCmsUser[SEATOOL_STATUS.APPROVED],
actionType: "New",
authority: "1915(c)",
state: "MD",
Expand All @@ -911,6 +966,7 @@ const items: Record<string, TestItemResult> = {
{
_source: {
changedDate: "2024-01-01T00:00:00Z",
makoChangedDate: "2024-01-01T00:00:00Z",
title: "Initial release",
cmsStatus: "Pending",
stateStatus: "Under Review",
Expand All @@ -919,6 +975,7 @@ const items: Record<string, TestItemResult> = {
{
_source: {
changedDate: "2025-01-08T00:00:00Z",
makoChangedDate: "2025-01-08T00:00:00Z",
title: "Approved release",
cmsStatus: "Approved",
stateStatus: "Approved",
Expand Down
1 change: 1 addition & 0 deletions react-app/src/api/useGetUser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export type OneMacUser = {
export const getUser = async (): Promise<OneMacUser> => {
try {
const currentAuthenticatedUser = await Auth.currentAuthenticatedUser();

if (!currentAuthenticatedUser) {
return { user: null } satisfies OneMacUser;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,10 @@ export const FilterChips: FC = () => {
}));

return (
<div className="justify-start items-center py-2 flex flex-wrap gap-y-2 gap-x-2">
<div
className="justify-start items-center py-2 flex flex-wrap gap-y-2 gap-x-2"
data-testid="chips"
>
{url.state.filters.map((filter, index) => {
const props: RenderProp = { clearFilter, openDrawer, filter, index };
const key = `${filter.field}-${index}`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import {
renderFilterDrawer,
DEFAULT_COLUMNS,
HIDDEN_COLUMN,
NO_FIELD_COLUMN,
NO_TRANSFORM_COLUMN,
getDashboardQueryString,
} from "@/utils/test-helpers";

const columns: OsTableColumn[] = [...DEFAULT_COLUMNS, NO_FIELD_COLUMN, HIDDEN_COLUMN];
const columns: OsTableColumn[] = [...DEFAULT_COLUMNS, NO_TRANSFORM_COLUMN, HIDDEN_COLUMN];

const setup = (disabled?: boolean) => {
const user = userEvent.setup();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const OsFiltering: FC<{
const context = useOsContext();

return (
<div className="my-2">
<div className="my-2" data-testid="filtering">
<p className="mb-1 text-sm">{"Search by Package ID, CPOC Name, or Submitter Name"}</p>
<div className="flex w-full lg:flex-row flex-col flex-grow content-between gap-2">
<SearchForm
Expand Down
Loading
Loading