import { generateText } from '~/vue_merge_request_widget/components/extensions/utils';
describe('generateText', () => {
it.each`
text | expectedText
${'%{strong_start}Hello world%{strong_end}'} | ${'Hello world'}
${'%{success_start}Hello world%{success_end}'} | ${'Hello world'}
${'%{danger_start}Hello world%{danger_end}'} | ${'Hello world'}
${'%{critical_start}Hello world%{critical_end}'} | ${'Hello world'}
${'%{same_start}Hello world%{same_end}'} | ${'Hello world'}
${'%{small_start}Hello world%{small_end}'} | ${'Hello world'}
${'%{strong_start}%{danger_start}Hello world%{danger_end}%{strong_end}'} | ${'Hello world'}
${'%{no_exist_start}Hello world%{no_exist_end}'} | ${'Hello world'}
${{ text: 'Hello world', href: 'http://www.example.com' }} | ${'Hello world'}
${{ prependText: 'Hello', text: 'world', href: 'http://www.example.com' }} | ${'Hello world'}
${['array']} | ${null}
`('generates $expectedText from $text', ({ text, expectedText }) => {
expect(generateText(text)).toBe(expectedText);
});
});