The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
import { generateMessageId } from '@/i18n/generate-message-id';
// Pairs lifted from twenty-server's en.po `js-lingui-id` comments, pinning parity with the Lingui CLI.
// A failure means persisted metadata labels no longer resolve against their catalog.
describe('generateMessageId', () => {
it.each([
['A company', 'kZR6+h'],
['12HRS', '0eYXBl'],
['{fieldType} fields cannot be unique.', 'ZkHTHm'],
])('matches the Lingui-generated id for %p', (message, expectedId) => {
expect(generateMessageId(message)).toBe(expectedId);
});
it('returns a six-character id', () => {
expect(generateMessageId('Export View')).toHaveLength(6);
});
it('treats an omitted context and an empty context as the same message', () => {
expect(generateMessageId('Export')).toBe(generateMessageId('Export', ''));
});
it('distinguishes the same message under different contexts', () => {
expect(generateMessageId('Export', 'commandMenuItem.shortLabel')).not.toBe(
generateMessageId('Export', 'view.name'),
);
});
});