import { getStringWithCustomValues } from '@/helpers/cms-content-helper.js'; describe('getStringWithCustomValues', () => { test.each([ ['Hello, {custom:name}!', { name: 'John' }, 'Hello, John!'], ['{custom:greeting}, {custom:name}!', { greeting: 'Hi', name: 'John' }, 'Hi, John!'], ['{custom:greeting}, {custom:name}!', { greeting: 'Hi' }, 'Hi, {custom:name}!'], ['Hello, {custom:name}!', {}, 'Hello, {custom:name}!'], ['Hello, world!', { name: 'John' }, 'Hello, world!'], ['', { name: 'John' }, ''], ['Hello, {custom:name}!', null, 'Hello, {custom:name}!'], ['Hello, {custom:name}!', undefined, 'Hello, {custom:name}!'], [null, { name: 'John' }, ''], [undefined, { name: 'John' }, ''] ])('getStringWithCustomValues(%s, %o) should return %s', (str, customValueMap, expected) => { expect(getStringWithCustomValues(str, customValueMap)).toBe(expected); }); });