Skip to content

Commit 5860b86

Browse files
committed
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.
1 parent 407b80a commit 5860b86

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

test/api/locale-fallback-chain.spec.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,10 @@ describe('Locale Fallback Chain Tests', () => {
146146
locale: result.locale
147147
});
148148
} catch (error: any) {
149-
if (error.status === 422) {
150-
console.log('⚠️ API returned 422 for non-existent locale (expected behavior)');
151-
expect(error.status).toBe(422);
149+
// API can return 422, 400, or 141 for invalid/non-existent locale
150+
if (error.status === 422 || error.status === 400 || error.status === 141) {
151+
console.log(`⚠️ API returned ${error.status} for non-existent locale (expected behavior)`);
152+
expect([422, 400, 141]).toContain(error.status);
152153
} else {
153154
throw error;
154155
}
@@ -346,9 +347,10 @@ describe('Locale Fallback Chain Tests', () => {
346347
hasContent: !!result.title
347348
});
348349
} catch (error: any) {
349-
if (error.status === 422) {
350-
console.log('⚠️ API rejected invalid locale format (expected)');
351-
expect(error.status).toBe(422);
350+
// API can return 422, 400, or 141 for invalid locale format
351+
if (error.status === 422 || error.status === 400 || error.status === 141) {
352+
console.log(`⚠️ API rejected invalid locale format with status ${error.status} (expected)`);
353+
expect([422, 400, 141]).toContain(error.status);
352354
} else {
353355
throw error;
354356
}

0 commit comments

Comments
 (0)