@@ -85,6 +85,19 @@ function parseX12Response(x12Content: string): AuthResponse {
8585 certificationTypeCode : 'A1'
8686 } ;
8787 }
88+ if ( x12Content . includes ( 'STC*A4' ) ) {
89+ return {
90+ authorizationNumber : 'AUTH20241119001' ,
91+ status : 'PENDED' ,
92+ certificationTypeCode : 'A4'
93+ } ;
94+ }
95+ if ( x12Content . includes ( 'STC*A3' ) ) {
96+ return {
97+ status : 'DENIED' ,
98+ certificationTypeCode : 'A3'
99+ } ;
100+ }
88101 return {
89102 status : 'ERROR' ,
90103 certificationTypeCode : 'NA'
@@ -255,7 +268,7 @@ describe('Authorization Request - Outpatient (UM01=HS)', () => {
255268 it ( 'should require service date range for outpatient' , ( ) => {
256269 // Test outpatient-specific validation
257270 const hasDateRange = ( request : any ) => {
258- return request . serviceDateRange ?. fromDate && request . serviceDateRange ?. toDate ;
271+ return ! ! ( request . serviceDateRange ?. fromDate && request . serviceDateRange ?. toDate ) ;
259272 } ;
260273
261274 const request = {
@@ -353,7 +366,7 @@ describe('Authorization Cancellation (UM02=3)', () => {
353366describe ( 'Eligibility Integration' , ( ) => {
354367
355368 it ( 'should check eligibility before submitting authorization' , async ( ) => {
356- const mockEligibilityCheck = jest . fn ( ) . mockResolvedValue ( {
369+ const mockEligibilityCheck = jest . fn < ( params : any ) => Promise < { eligible : boolean ; coverageLevel : string } > > ( ) . mockResolvedValue ( {
357370 eligible : true ,
358371 coverageLevel : 'Active Coverage'
359372 } ) ;
@@ -369,7 +382,7 @@ describe('Eligibility Integration', () => {
369382 } ) ;
370383
371384 it ( 'should reject authorization if member not eligible' , async ( ) => {
372- const mockEligibilityCheck = jest . fn ( ) . mockResolvedValue ( {
385+ const mockEligibilityCheck = jest . fn < ( params : any ) => Promise < { eligible : boolean ; reason : string } > > ( ) . mockResolvedValue ( {
373386 eligible : false ,
374387 reason : 'Coverage terminated'
375388 } ) ;
@@ -416,13 +429,13 @@ describe('Attachment Workflow Integration', () => {
416429describe ( 'Error Handling' , ( ) => {
417430
418431 it ( 'should handle X12 encoding errors gracefully' , ( ) => {
419- const mockEncode = jest . fn ( ) . mockRejectedValue ( new Error ( 'Integration Account not configured' ) ) ;
432+ const mockEncode = jest . fn < ( ) => Promise < void > > ( ) . mockRejectedValue ( new Error ( 'Integration Account not configured' ) ) ;
420433
421434 expect ( mockEncode ) . rejects . toThrow ( 'Integration Account not configured' ) ;
422435 } ) ;
423436
424437 it ( 'should handle payer endpoint timeouts' , async ( ) => {
425- const mockPostToPayer = jest . fn ( ) . mockRejectedValue ( new Error ( 'Request timeout' ) ) ;
438+ const mockPostToPayer = jest . fn < ( ) => Promise < void > > ( ) . mockRejectedValue ( new Error ( 'Request timeout' ) ) ;
426439
427440 await expect ( mockPostToPayer ( ) ) . rejects . toThrow ( 'Request timeout' ) ;
428441 } ) ;
0 commit comments