[grade=B] fix: i18n detectLanguage RFC 7231 q-value compliance + stale test fixes
- Fix detectLanguage() to sort by HTTP q-values per RFC 7231 (was first-match-wins)
- Strict qvalue grammar: /^(0(?:\.\d{0,3})?|1(?:\.0{0,3})?)$/
- Exclude q=0 entries (not acceptable per RFC)
- Case-insensitive Q parameter name
- Fix 5 stale tests: zh/ja now supported (31 languages, not 5)
- Add 7 boundary regression tests for q-value parsing
- All 1781 tests pass
Codex grade: B (urn:ump:6yumklcezgiaemcg5t2mebuoi4w2n5dexozm4j7h5pu5g2s4p5ta)
This commit is contained in:
@@ -14,13 +14,13 @@ function createI18nApp() {
|
||||
}
|
||||
|
||||
describe('DC-077: i18n Routes', () => {
|
||||
it('GET /i18n/languages returns 5 languages', async () => {
|
||||
it('GET /i18n/languages returns 31 languages', async () => {
|
||||
const app = createI18nApp();
|
||||
const res = await request(app).get('/api/v1/i18n/languages');
|
||||
|
||||
expect(res.status).toBe(200);
|
||||
expect(res.body.success).toBe(true);
|
||||
expect(res.body.languages).toHaveLength(5);
|
||||
expect(res.body.languages).toHaveLength(31);
|
||||
expect(res.body.default).toBe('en');
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user