fix(i18n): preserve custom statuses matching inherited alias names

This commit is contained in:
cesnimda
2026-11-02 22:25:09 +01:00
parent 7b132ec4b4
commit 36db932235
3 changed files with 18 additions and 1 deletions
+6
View File
@@ -10,6 +10,12 @@ import {
} from './pipeline';
describe('pipeline', () => {
test.each(['constructor', '__proto__', 'toString'])('keeps inherited alias name %s as a custom status', status => {
const translate = jest.fn(() => 'translated');
expect(normalizeStatus(status)).toBe('Other');
expect(statusLabel(translate, status)).toBe(status);
expect(translate).not.toHaveBeenCalled();
});
test('normalizeStatus canonicalizes casing and synonyms', () => {
expect(normalizeStatus('applied')).toBe('Applied');
expect(normalizeStatus(' OFFER ')).toBe('Offer');
+1 -1
View File
@@ -102,7 +102,7 @@ export function normalizeStatus(status?: string | null): PipelineStatus | "Other
const exact = PIPELINE_STATUSES.find((s) => s.toLowerCase() === trimmed.toLowerCase());
if (exact) return exact;
const alias = ALIASES[trimmed.toLowerCase()];
return alias ?? "Other";
return Object.hasOwn(ALIASES, trimmed.toLowerCase()) ? alias : "Other";
}
/** MUI palette key for a status; both chip color and board accent derive from this. */