n8n/packages/design-system/src/utils/labelUtil.spec.ts

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

30 lines
634 B
TypeScript
Raw Normal View History

import { getInitials } from './labelUtil';
describe('labelUtil.getInitials', () => {
it.each([
['', ''],
// simple words
['Hello', 'He'],
['Hello World', 'HW'],
['H', 'H'],
// multiple spaces
['Double Space', 'DS'],
[' ', ''],
// simple emoji
['👋 Hello', '👋H'],
['👋Hello', '👋H'],
['Hello 👋', 'H👋'],
['Hello👋', 'He'],
// combined emojis
['1⃣ 1⃣', '1⃣1⃣'],
['1⃣', '1⃣'],
['👩D 👩D', '👩‍⚕️👩‍⚕️'],
])('turns "%s" into "%s"', (input, output) => {
expect(getInitials(input)).toBe(output);
});
});