diff --git a/src/helpers/text-helper.js b/src/helpers/text-helper.js index 220b1d3f..6ff5ad47 100644 --- a/src/helpers/text-helper.js +++ b/src/helpers/text-helper.js @@ -18,7 +18,7 @@ export function stripRteStyle(stringWithStyleTag) { * @returns {string} converted string wrapped in an
    */ export function createOrderedListFromStringOfParagraphs(stringOfParagraphs) { - return `
      ${stringOfParagraphs.replaceAll('

      ', '

    1. ').replaceAll('

      ', '
    2. ')}
    `; + return `
      ${stringOfParagraphs.replaceAll('

      ', '').replaceAll('

      ', '

    1. ').replaceAll('

      ', '
    2. ')}
    `; } /** diff --git a/src/helpers/text-helper.spec.js b/src/helpers/text-helper.spec.js index fcb7a88d..689d5c59 100644 --- a/src/helpers/text-helper.spec.js +++ b/src/helpers/text-helper.spec.js @@ -74,12 +74,23 @@ describe('text-helper', () => { ])('formatAmountInDollars(%s) should return %s', (amount, expected) => { expect(formatAmountInDollars(amount)).toBe(expected); }); - test('returns orderedlist from paragraph string', () => { - // Arrange - const testData = '

    String one

    String two

    '; - const expected = '
    1. String one
    2. String two
    '; + describe('createOrderedListFromStringOfParagraphs', () => { + test('returns orderedlist from paragraph string', () => { + // Arrange + const testData = '

    String one

    String two

    '; + const expected = '
    1. String one
    2. String two
    '; - // Assert - expect(createOrderedListFromStringOfParagraphs(testData)).toBe(expected); + // Assert + expect(createOrderedListFromStringOfParagraphs(testData)).toBe(expected); + }); + + test('returns orderedlist from paragraph string with empty

    tag', () => { + // Arrange + const testData = '

    String one

    String two

    '; + const expected = '
    1. String one
    2. String two
    '; + + // Assert + expect(createOrderedListFromStringOfParagraphs(testData)).toBe(expected); + }); }); });