fix(i18n): preserve custom statuses matching inherited alias names
This commit is contained in:
@@ -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');
|
||||
|
||||
@@ -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. */
|
||||
|
||||
Reference in New Issue
Block a user