From 5860b86003ffae15031c4eb3279bfa42ba51a1db Mon Sep 17 00:00:00 2001 From: Aniket Shikhare <62753263+AniketDev7@users.noreply.github.com> Date: Mon, 9 Feb 2026 15:05:04 +0530 Subject: [PATCH] Fix locale error status code assertions to support 400 and 141 Updated locale fallback chain tests to handle multiple valid API error status codes (422, 400, 141) for invalid/non-existent locale scenarios, aligning with JS CDA SDK behavior. --- test/api/locale-fallback-chain.spec.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/test/api/locale-fallback-chain.spec.ts b/test/api/locale-fallback-chain.spec.ts index d453cad..b16096e 100644 --- a/test/api/locale-fallback-chain.spec.ts +++ b/test/api/locale-fallback-chain.spec.ts @@ -146,9 +146,10 @@ describe('Locale Fallback Chain Tests', () => { locale: result.locale }); } catch (error: any) { - if (error.status === 422) { - console.log('⚠️ API returned 422 for non-existent locale (expected behavior)'); - expect(error.status).toBe(422); + // API can return 422, 400, or 141 for invalid/non-existent locale + if (error.status === 422 || error.status === 400 || error.status === 141) { + console.log(`⚠️ API returned ${error.status} for non-existent locale (expected behavior)`); + expect([422, 400, 141]).toContain(error.status); } else { throw error; } @@ -346,9 +347,10 @@ describe('Locale Fallback Chain Tests', () => { hasContent: !!result.title }); } catch (error: any) { - if (error.status === 422) { - console.log('⚠️ API rejected invalid locale format (expected)'); - expect(error.status).toBe(422); + // API can return 422, 400, or 141 for invalid locale format + if (error.status === 422 || error.status === 400 || error.status === 141) { + console.log(`⚠️ API rejected invalid locale format with status ${error.status} (expected)`); + expect([422, 400, 141]).toContain(error.status); } else { throw error; }