Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 0 additions & 2 deletions backend/src/sync/eligibility/eligibility.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ export const PROTECTED_STATUSES = [
CSA_STATUS.BATCH_SENT_CANCELLATION,
CSA_STATUS.APPLICATION_REFUSED_CRA,
CSA_STATUS.CANCELLATION_REFUSED_CRA,
CSA_STATUS.ELIGIBLE_TBD,
CSA_STATUS.NOT_ELIGIBLE_IP_TBD,
CSA_STATUS.OVER_18,
] as const

Expand Down
1 change: 1 addition & 0 deletions backend/src/sync/eligibility/rules/rule-runner.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ describe('runEligibility integration: step3 → step4 → step6', () => {
makePlacement({
status: 'Active',
contractNumber: 'C-100',
startDate: new Date('2026-03-01'),
}),
],
orders: [
Expand Down
35 changes: 35 additions & 0 deletions backend/src/sync/eligibility/rules/steps/outcomes.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,16 @@ describe('step7_UpdateEligible', () => {
})
})

it('should return eligible when current status is eligible_tbd', () => {
const result = step7_UpdateEligible(CSA_STATUS.ELIGIBLE_TBD)
expect(result.newStatus).toBe(CSA_STATUS.ELIGIBLE)
})

it('should return in_pay when current status is not_eligible_ip_tbd', () => {
const result = step7_UpdateEligible(CSA_STATUS.NOT_ELIGIBLE_IP_TBD)
expect(result.newStatus).toBe(CSA_STATUS.IN_PAY)
})

it('should keep existing status when no transition applies', () => {
const result = step7_UpdateEligible(CSA_STATUS.ELIGIBLE)
expect(result.step).toBe(7)
Expand Down Expand Up @@ -80,6 +90,16 @@ describe('step9_UpdateNotEligible', () => {
expect(result.careEndDate).toEqual(careEnd)
})

it('should return not_eligible_out_of_pay when current status is eligible_tbd', () => {
const result = step9_UpdateNotEligible(CSA_STATUS.ELIGIBLE_TBD)
expect(result.newStatus).toBe(CSA_STATUS.NOT_ELIGIBLE_OUT_OF_PAY)
})

it('should return not_eligible_out_of_pay when current status is not_eligible_ip_tbd', () => {
const result = step9_UpdateNotEligible(CSA_STATUS.NOT_ELIGIBLE_IP_TBD)
expect(result.newStatus).toBe(CSA_STATUS.NOT_ELIGIBLE_OUT_OF_PAY)
})

it('should keep existing status when no transition applies', () => {
const result = step9_UpdateNotEligible(CSA_STATUS.ON_HOLD)
expect(result.newStatus).toBe(CSA_STATUS.ON_HOLD)
Expand Down Expand Up @@ -107,6 +127,21 @@ describe('step10_UpdateOver18', () => {
expect(result.newStatus).toBe(CSA_STATUS.OVER_18)
})

it('should return over_18 when current status is eligible_tbd', () => {
const result = step10_UpdateOver18(CSA_STATUS.ELIGIBLE_TBD)
expect(result.newStatus).toBe(CSA_STATUS.OVER_18)
})

it('should return over_18 when current status is not_eligible_in_pay', () => {
const result = step10_UpdateOver18(CSA_STATUS.NOT_ELIGIBLE_IN_PAY)
expect(result.newStatus).toBe(CSA_STATUS.OVER_18)
})

it('should return over_18 when current status is not_eligible_ip_tbd', () => {
const result = step10_UpdateOver18(CSA_STATUS.NOT_ELIGIBLE_IP_TBD)
expect(result.newStatus).toBe(CSA_STATUS.OVER_18)
})

it('should keep existing status when no transition applies', () => {
const result = step10_UpdateOver18(CSA_STATUS.ON_HOLD)
expect(result.newStatus).toBe(CSA_STATUS.ON_HOLD)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ export function step10_UpdateOver18(currentStatus: CsaStatus | null): Eligibilit
let newStatus: CsaStatus | null = null
if (
currentStatus === CSA_STATUS.ELIGIBLE ||
currentStatus === CSA_STATUS.ELIGIBLE_TBD ||
currentStatus === CSA_STATUS.IN_PAY ||
currentStatus === CSA_STATUS.NOT_ELIGIBLE_OUT_OF_PAY ||
currentStatus === CSA_STATUS.NOT_ELIGIBLE_IN_PAY ||
currentStatus === CSA_STATUS.NOT_ELIGIBLE_IP_TBD ||
currentStatus === null
) {
newStatus = CSA_STATUS.OVER_18
Expand Down
Loading
Loading