-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
E2E Tests for assessment gateway
- Loading branch information
1 parent
3cf7e96
commit e13e613
Showing
21 changed files
with
609 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export * from "./system-configurations-constants"; | ||
export * from "./error-code.constants"; | ||
export * from "./disbursements.constants"; | ||
export * from "./worker-constants"; |
13 changes: 13 additions & 0 deletions
13
sources/packages/backend/libs/services/src/constants/worker-constants.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
export enum Workers { | ||
AssociateWorkflowInstance = "associate-workflow-instance", | ||
VerifyApplicationExceptions = "verify-application-exceptions", | ||
ProgramInfoRequest = "program-info-request", | ||
CreateIncomeRequest = "create-income-request", | ||
CheckIncomeRequest = "check-income-request", | ||
UpdateApplicationStatus = "update-application-status", | ||
LoadAssessmentConsolidatedData = "load-assessment-consolidated-data", | ||
UpdateNOAStatus = "update-noa-status", | ||
SaveAssessmentData = "save-assessment-data", | ||
SaveDisbursementSchedules = "save-disbursement-schedules", | ||
AssociateMSFAA = "associate-msfaa", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
...kflow/test/2021-2022/assessment-gateway/assessment-gateway.originalAssessment.e2e-spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import { ASSESSMENT_ID } from "@sims/services/workflow/variables/assessment-gateway"; | ||
import { | ||
ApplicationExceptionStatus, | ||
AssessmentTriggerType, | ||
} from "@sims/sims-db"; | ||
import { AssessmentConsolidatedData } from "../../models"; | ||
import { ZBClient } from "zeebe-node"; | ||
import { | ||
createFakeConsolidatedFulltimeData, | ||
ZeebeMockedClient, | ||
PROCESS_INSTANCE_CREATE_TIMEOUT, | ||
WorkflowServiceTasks, | ||
createFakeSingleIndependentStudentData, | ||
expectToPassThroughServiceTasks, | ||
} from "../../test-utils"; | ||
import { PROGRAM_YEAR } from "../constants/program-year.constants"; | ||
|
||
describe(`E2E Test Workflow assessment gateway on original assessment for ${PROGRAM_YEAR}`, () => { | ||
let zeebeClientProvider: ZBClient; | ||
beforeAll(async () => { | ||
zeebeClientProvider = ZeebeMockedClient.getMockedZeebeInstance(); | ||
}); | ||
|
||
it("Should follow the expected workflow path when student is single and independent without application exception and PIR.", async () => { | ||
// Arrange | ||
const assessmentConsolidatedData: AssessmentConsolidatedData = { | ||
...createFakeConsolidatedFulltimeData(PROGRAM_YEAR), | ||
assessmentTriggerType: AssessmentTriggerType.OriginalAssessment, | ||
...createFakeSingleIndependentStudentData(), | ||
// Application with PIR not required. | ||
studentDataSelectedOffering: 1, | ||
}; | ||
|
||
// Act/Assert | ||
const assessmentGatewayResponse = | ||
await zeebeClientProvider.createProcessInstanceWithResult({ | ||
bpmnProcessId: "assessment-gateway", | ||
variables: { | ||
[ASSESSMENT_ID]: 1, | ||
// Data that will be returned by the worker that subscribe to load assessment data service task. | ||
[`${WorkflowServiceTasks.LoadAssessmentConsolidatedData}-result`]: | ||
assessmentConsolidatedData, | ||
[`${WorkflowServiceTasks.VerifyApplicationExceptions}-result`]: { | ||
// Application with no exception. | ||
applicationExceptionStatus: ApplicationExceptionStatus.Approved, | ||
}, | ||
}, | ||
requestTimeout: PROCESS_INSTANCE_CREATE_TIMEOUT, | ||
}); | ||
expectToPassThroughServiceTasks( | ||
assessmentGatewayResponse.variables, | ||
WorkflowServiceTasks.AssociateWorkflowInstance, | ||
WorkflowServiceTasks.VerifyApplicationExceptions, | ||
WorkflowServiceTasks.ProgramInfoNotRequired, | ||
WorkflowServiceTasks.SaveDisbursementSchedules, | ||
WorkflowServiceTasks.AssociateMSFAA, | ||
WorkflowServiceTasks.UpdateNOAStatusToRequired, | ||
); | ||
}); | ||
}); |
54 changes: 54 additions & 0 deletions
54
...d/workflow/test/2021-2022/assessment-gateway/assessment-gateway.studentAppeal.e2e-spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { ASSESSMENT_ID } from "@sims/services/workflow/variables/assessment-gateway"; | ||
import { AssessmentTriggerType } from "@sims/sims-db"; | ||
import { ZBClient } from "zeebe-node"; | ||
import { AssessmentConsolidatedData } from "../../models"; | ||
import { | ||
createFakeConsolidatedFulltimeData, | ||
ZeebeMockedClient, | ||
PROCESS_INSTANCE_CREATE_TIMEOUT, | ||
WorkflowServiceTasks, | ||
createFakeSingleIndependentStudentData, | ||
expectToPassThroughServiceTasks, | ||
expectNotToPassThroughServiceTasks, | ||
} from "../../test-utils"; | ||
import { PROGRAM_YEAR } from "../constants/program-year.constants"; | ||
|
||
describe(`E2E Test Workflow assessment gateway on student appeal for ${PROGRAM_YEAR}`, () => { | ||
let zeebeClientProvider: ZBClient; | ||
beforeAll(async () => { | ||
zeebeClientProvider = ZeebeMockedClient.getMockedZeebeInstance(); | ||
}); | ||
|
||
it("Should follow the expected workflow path when student single and independent.", async () => { | ||
// Arrange | ||
const assessmentConsolidatedData: AssessmentConsolidatedData = { | ||
...createFakeConsolidatedFulltimeData(PROGRAM_YEAR), | ||
assessmentTriggerType: AssessmentTriggerType.StudentAppeal, | ||
...createFakeSingleIndependentStudentData(), | ||
}; | ||
|
||
// Act/Assert | ||
const assessmentGatewayResponse = | ||
await zeebeClientProvider.createProcessInstanceWithResult({ | ||
bpmnProcessId: "assessment-gateway", | ||
variables: { | ||
[ASSESSMENT_ID]: 1, | ||
// Data that will be returned by the worker that subscribe to load assessment data service task. | ||
[`${WorkflowServiceTasks.LoadAssessmentConsolidatedData}-result`]: | ||
assessmentConsolidatedData, | ||
}, | ||
requestTimeout: PROCESS_INSTANCE_CREATE_TIMEOUT, | ||
}); | ||
expectToPassThroughServiceTasks( | ||
assessmentGatewayResponse.variables, | ||
WorkflowServiceTasks.AssociateWorkflowInstance, | ||
WorkflowServiceTasks.SaveDisbursementSchedules, | ||
WorkflowServiceTasks.UpdateNOAStatusToNotRequired, | ||
); | ||
expectNotToPassThroughServiceTasks( | ||
assessmentGatewayResponse.variables, | ||
WorkflowServiceTasks.UpdateApplicationStatusToInProgress, | ||
WorkflowServiceTasks.UpdateApplicationStatusToAssessment, | ||
); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
...kflow/test/2022-2023/assessment-gateway/assessment-gateway.originalAssessment.e2e-spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import { ASSESSMENT_ID } from "@sims/services/workflow/variables/assessment-gateway"; | ||
import { | ||
ApplicationExceptionStatus, | ||
AssessmentTriggerType, | ||
} from "@sims/sims-db"; | ||
import { ZBClient } from "zeebe-node"; | ||
import { AssessmentConsolidatedData } from "../../models"; | ||
import { | ||
createFakeConsolidatedFulltimeData, | ||
ZeebeMockedClient, | ||
PROCESS_INSTANCE_CREATE_TIMEOUT, | ||
WorkflowServiceTasks, | ||
createFakeSingleIndependentStudentData, | ||
expectToPassThroughServiceTasks, | ||
} from "../../test-utils"; | ||
import { PROGRAM_YEAR } from "../constants/program-year.constants"; | ||
|
||
describe(`E2E Test Workflow assessment gateway on original assessment for ${PROGRAM_YEAR}`, () => { | ||
let zeebeClientProvider: ZBClient; | ||
beforeAll(async () => { | ||
zeebeClientProvider = ZeebeMockedClient.getMockedZeebeInstance(); | ||
}); | ||
|
||
it("Should follow the expected workflow path when student is single and independent without application exception and PIR.", async () => { | ||
// Arrange | ||
const assessmentConsolidatedData: AssessmentConsolidatedData = { | ||
...createFakeConsolidatedFulltimeData(PROGRAM_YEAR), | ||
assessmentTriggerType: AssessmentTriggerType.OriginalAssessment, | ||
...createFakeSingleIndependentStudentData(), | ||
// Application with PIR not required. | ||
studentDataSelectedOffering: 1, | ||
}; | ||
|
||
// Act/Assert | ||
const assessmentGatewayResponse = | ||
await zeebeClientProvider.createProcessInstanceWithResult({ | ||
bpmnProcessId: "assessment-gateway", | ||
variables: { | ||
[ASSESSMENT_ID]: 1, | ||
// Data that will be returned by the worker that subscribe to load assessment data service task. | ||
[`${WorkflowServiceTasks.LoadAssessmentConsolidatedData}-result`]: | ||
assessmentConsolidatedData, | ||
[`${WorkflowServiceTasks.VerifyApplicationExceptions}-result`]: { | ||
// Application with no exception. | ||
applicationExceptionStatus: ApplicationExceptionStatus.Approved, | ||
}, | ||
}, | ||
requestTimeout: PROCESS_INSTANCE_CREATE_TIMEOUT, | ||
}); | ||
expectToPassThroughServiceTasks( | ||
assessmentGatewayResponse.variables, | ||
WorkflowServiceTasks.AssociateWorkflowInstance, | ||
WorkflowServiceTasks.VerifyApplicationExceptions, | ||
WorkflowServiceTasks.ProgramInfoNotRequired, | ||
WorkflowServiceTasks.SaveDisbursementSchedules, | ||
WorkflowServiceTasks.AssociateMSFAA, | ||
WorkflowServiceTasks.UpdateNOAStatusToRequired, | ||
); | ||
}); | ||
}); |
Oops, something went wrong.