-
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.
Merge branch 'main' into feature/#1862-uxui-for-ignore-restriction-by…
…pass-list
- Loading branch information
Showing
17 changed files
with
817 additions
and
229 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
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
File renamed without changes.
111 changes: 111 additions & 0 deletions
111
...application/_tests_/application.aest.controller.getApplicationProgressDetails.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,111 @@ | ||
import { HttpStatus, INestApplication } from "@nestjs/common"; | ||
import * as request from "supertest"; | ||
import { | ||
AESTGroups, | ||
BEARER_AUTH_TYPE, | ||
createTestingAppModule, | ||
getAESTToken, | ||
} from "../../../testHelpers"; | ||
import { | ||
E2EDataSources, | ||
MSFAAStates, | ||
createE2EDataSources, | ||
createFakeMSFAANumber, | ||
saveFakeApplicationDisbursements, | ||
saveFakeStudent, | ||
} from "@sims/test-utils"; | ||
import { | ||
ApplicationStatus, | ||
AssessmentTriggerType, | ||
COEStatus, | ||
MSFAANumber, | ||
OfferingIntensity, | ||
ProgramInfoStatus, | ||
Student, | ||
} from "@sims/sims-db"; | ||
|
||
describe("ApplicationAESTController(e2e)-getApplicationProgressDetails", () => { | ||
let app: INestApplication; | ||
let db: E2EDataSources; | ||
let sharedStudent: Student; | ||
let sharedPartTimeSignedMSFAANumber: MSFAANumber; | ||
|
||
beforeAll(async () => { | ||
const { nestApplication, dataSource } = await createTestingAppModule(); | ||
app = nestApplication; | ||
db = createE2EDataSources(dataSource); | ||
// Create a student with valid SIN and valid MSFAA number. | ||
sharedStudent = await saveFakeStudent(db.dataSource); | ||
sharedPartTimeSignedMSFAANumber = createFakeMSFAANumber( | ||
{ student: sharedStudent }, | ||
{ | ||
msfaaState: MSFAAStates.Signed, | ||
msfaaInitialValues: { offeringIntensity: OfferingIntensity.partTime }, | ||
}, | ||
); | ||
await db.msfaaNumber.save(sharedPartTimeSignedMSFAANumber); | ||
}); | ||
|
||
it( | ||
"Should get the status of all requests and confirmations in student application" + | ||
" when the application is in 'Completed' status with original assessment and valid MSFAA Number" + | ||
" and COE is completed and offering intensity is part-time.", | ||
async () => { | ||
// Arrange | ||
const application = await saveFakeApplicationDisbursements( | ||
db.dataSource, | ||
{ | ||
student: sharedStudent, | ||
msfaaNumber: sharedPartTimeSignedMSFAANumber, | ||
}, | ||
{ | ||
offeringIntensity: OfferingIntensity.partTime, | ||
applicationStatus: ApplicationStatus.Completed, | ||
pirStatus: ProgramInfoStatus.notRequired, | ||
firstDisbursementInitialValues: { coeStatus: COEStatus.completed }, | ||
}, | ||
); | ||
|
||
const endpoint = `/aest/application/${application.id}/progress-details`; | ||
// As the feature is accessible for all groups, using a group other than business administrators. | ||
const token = await getAESTToken(AESTGroups.Operations); | ||
|
||
// Act/Assert | ||
await request(app.getHttpServer()) | ||
.get(endpoint) | ||
.auth(token, BEARER_AUTH_TYPE) | ||
.expect(HttpStatus.OK) | ||
.expect({ | ||
applicationStatus: ApplicationStatus.Completed, | ||
applicationStatusUpdatedOn: | ||
application.applicationStatusUpdatedOn.toISOString(), | ||
pirStatus: ProgramInfoStatus.notRequired, | ||
firstCOEStatus: COEStatus.completed, | ||
assessmentTriggerType: AssessmentTriggerType.OriginalAssessment, | ||
hasBlockFundingFeedbackError: false, | ||
hasECertFailedValidations: false, | ||
}); | ||
}, | ||
); | ||
|
||
it("Should throw not found error when application is not found.", async () => { | ||
// Arrange | ||
const endpoint = "/aest/application/99999999/progress-details"; | ||
const token = await getAESTToken(AESTGroups.BusinessAdministrators); | ||
|
||
// Act/Assert | ||
await request(app.getHttpServer()) | ||
.get(endpoint) | ||
.auth(token, BEARER_AUTH_TYPE) | ||
.expect(HttpStatus.NOT_FOUND) | ||
.expect({ | ||
statusCode: HttpStatus.NOT_FOUND, | ||
message: "Application id 99999999 was not found.", | ||
error: "Not Found", | ||
}); | ||
}); | ||
|
||
afterAll(async () => { | ||
await app?.close(); | ||
}); | ||
}); |
107 changes: 107 additions & 0 deletions
107
...pplication/_tests_/application.aest.controller.getCompletedApplicationDetails.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,107 @@ | ||
import { HttpStatus, INestApplication } from "@nestjs/common"; | ||
import * as request from "supertest"; | ||
import { | ||
AESTGroups, | ||
BEARER_AUTH_TYPE, | ||
createTestingAppModule, | ||
getAESTToken, | ||
} from "../../../testHelpers"; | ||
import { | ||
E2EDataSources, | ||
MSFAAStates, | ||
createE2EDataSources, | ||
createFakeMSFAANumber, | ||
saveFakeApplicationDisbursements, | ||
saveFakeStudent, | ||
} from "@sims/test-utils"; | ||
import { | ||
ApplicationStatus, | ||
AssessmentTriggerType, | ||
COEStatus, | ||
DisbursementScheduleStatus, | ||
MSFAANumber, | ||
OfferingIntensity, | ||
Student, | ||
} from "@sims/sims-db"; | ||
|
||
describe("ApplicationAESTController(e2e)-getCompletedApplicationDetails", () => { | ||
let app: INestApplication; | ||
let db: E2EDataSources; | ||
let sharedStudent: Student; | ||
let sharedPartTimeSignedMSFAANumber: MSFAANumber; | ||
|
||
beforeAll(async () => { | ||
const { nestApplication, dataSource } = await createTestingAppModule(); | ||
app = nestApplication; | ||
db = createE2EDataSources(dataSource); | ||
// Create a student with valid SIN and valid MSFAA number. | ||
sharedStudent = await saveFakeStudent(db.dataSource); | ||
sharedPartTimeSignedMSFAANumber = createFakeMSFAANumber( | ||
{ student: sharedStudent }, | ||
{ | ||
msfaaState: MSFAAStates.Signed, | ||
msfaaInitialValues: { offeringIntensity: OfferingIntensity.partTime }, | ||
}, | ||
); | ||
await db.msfaaNumber.save(sharedPartTimeSignedMSFAANumber); | ||
}); | ||
|
||
it( | ||
"Should get application details when application is in 'Completed' status" + | ||
" with original assessment and valid MSFAA Number and offering intensity is part-time.", | ||
async () => { | ||
// Arrange | ||
const application = await saveFakeApplicationDisbursements( | ||
db.dataSource, | ||
{ | ||
student: sharedStudent, | ||
msfaaNumber: sharedPartTimeSignedMSFAANumber, | ||
}, | ||
{ | ||
offeringIntensity: OfferingIntensity.partTime, | ||
applicationStatus: ApplicationStatus.Completed, | ||
firstDisbursementInitialValues: { coeStatus: COEStatus.completed }, | ||
}, | ||
); | ||
|
||
const endpoint = `/aest/application/${application.id}/completed`; | ||
const token = await getAESTToken(AESTGroups.BusinessAdministrators); | ||
|
||
// Act/Assert | ||
await request(app.getHttpServer()) | ||
.get(endpoint) | ||
.auth(token, BEARER_AUTH_TYPE) | ||
.expect(HttpStatus.OK) | ||
.expect({ | ||
firstDisbursement: { | ||
coeStatus: COEStatus.completed, | ||
disbursementScheduleStatus: DisbursementScheduleStatus.Pending, | ||
}, | ||
assessmentTriggerType: AssessmentTriggerType.OriginalAssessment, | ||
hasBlockFundingFeedbackError: false, | ||
eCertFailedValidations: [], | ||
}); | ||
}, | ||
); | ||
|
||
it("Should throw not found error when application is not found.", async () => { | ||
// Arrange | ||
const endpoint = "/aest/application/99999999/completed"; | ||
const token = await getAESTToken(AESTGroups.BusinessAdministrators); | ||
|
||
// Act/Assert | ||
await request(app.getHttpServer()) | ||
.get(endpoint) | ||
.auth(token, BEARER_AUTH_TYPE) | ||
.expect(HttpStatus.NOT_FOUND) | ||
.expect({ | ||
statusCode: HttpStatus.NOT_FOUND, | ||
message: "Application not found or not on Completed status.", | ||
error: "Not Found", | ||
}); | ||
}); | ||
|
||
afterAll(async () => { | ||
await app?.close(); | ||
}); | ||
}); |
86 changes: 86 additions & 0 deletions
86
...pplication/_tests_/application.aest.controller.getEnrolmentApplicationDetails.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,86 @@ | ||
import { HttpStatus, INestApplication } from "@nestjs/common"; | ||
import * as request from "supertest"; | ||
import { | ||
AESTGroups, | ||
BEARER_AUTH_TYPE, | ||
createTestingAppModule, | ||
getAESTToken, | ||
} from "../../../testHelpers"; | ||
import { | ||
E2EDataSources, | ||
createE2EDataSources, | ||
saveFakeApplicationDisbursements, | ||
} from "@sims/test-utils"; | ||
import { | ||
ApplicationStatus, | ||
AssessmentTriggerType, | ||
COEStatus, | ||
DisbursementScheduleStatus, | ||
OfferingIntensity, | ||
} from "@sims/sims-db"; | ||
|
||
describe("ApplicationAESTController(e2e)-getEnrolmentApplicationDetails", () => { | ||
let app: INestApplication; | ||
let db: E2EDataSources; | ||
|
||
beforeAll(async () => { | ||
const { nestApplication, dataSource } = await createTestingAppModule(); | ||
app = nestApplication; | ||
db = createE2EDataSources(dataSource); | ||
}); | ||
|
||
it( | ||
"Should get application enrolment details when the application is in 'Enrolment' status" + | ||
" with original assessment and offering intensity is part-time.", | ||
async () => { | ||
// Arrange | ||
const application = await saveFakeApplicationDisbursements( | ||
db.dataSource, | ||
undefined, | ||
{ | ||
offeringIntensity: OfferingIntensity.partTime, | ||
applicationStatus: ApplicationStatus.Enrolment, | ||
firstDisbursementInitialValues: { coeStatus: COEStatus.required }, | ||
}, | ||
); | ||
|
||
const endpoint = `/aest/application/${application.id}/enrolment`; | ||
const token = await getAESTToken(AESTGroups.BusinessAdministrators); | ||
|
||
// Act/Assert | ||
await request(app.getHttpServer()) | ||
.get(endpoint) | ||
.auth(token, BEARER_AUTH_TYPE) | ||
.expect(HttpStatus.OK) | ||
.expect({ | ||
firstDisbursement: { | ||
coeStatus: COEStatus.required, | ||
disbursementScheduleStatus: DisbursementScheduleStatus.Pending, | ||
}, | ||
assessmentTriggerType: AssessmentTriggerType.OriginalAssessment, | ||
}); | ||
}, | ||
); | ||
|
||
it("Should throw not found error when application is not found.", async () => { | ||
// Arrange | ||
const endpoint = "/aest/application/99999999/enrolment"; | ||
const token = await getAESTToken(AESTGroups.BusinessAdministrators); | ||
|
||
// Act/Assert | ||
await request(app.getHttpServer()) | ||
.get(endpoint) | ||
.auth(token, BEARER_AUTH_TYPE) | ||
.expect(HttpStatus.NOT_FOUND) | ||
.expect({ | ||
statusCode: HttpStatus.NOT_FOUND, | ||
message: | ||
"Application id 99999999 not found or not in relevant status to get enrolment details.", | ||
error: "Not Found", | ||
}); | ||
}); | ||
|
||
afterAll(async () => { | ||
await app?.close(); | ||
}); | ||
}); |
Oops, something went wrong.