From e852436282a289736cedfc72f8da77c4ee19ba93 Mon Sep 17 00:00:00 2001 From: truph01 Date: Wed, 19 Mar 2025 12:42:12 +0700 Subject: [PATCH 1/7] fix: update mention room regex --- lib/ExpensiMark.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ExpensiMark.ts b/lib/ExpensiMark.ts index 16be76e66..2c1739d57 100644 --- a/lib/ExpensiMark.ts +++ b/lib/ExpensiMark.ts @@ -350,7 +350,7 @@ export default class ExpensiMark { { name: 'reportMentions', - regex: /(?<=^[*~_]?|[ \n][*~_]?)(#[\p{Ll}0-9-]{1,99})(?![^<]*(?:<\/pre>|<\/code>|<\/a>))/gimu, + regex: /(?<=^|[*~_]?|[ \n][*~_]?)(#[\p{Ll}0-9-]{1,99})(?![^<]*(?:<\/pre>|<\/code>|<\/a>))/gimu, replacement: '$1', }, From ea5554de97f888da30b8cfcfbfa43fab62556215 Mon Sep 17 00:00:00 2001 From: truph01 Date: Tue, 1 Apr 2025 00:12:53 +0700 Subject: [PATCH 2/7] fix: add unit test --- __tests__/ExpensiMark-HTML-test.js | 96 +++++++++++++++++------------- 1 file changed, 54 insertions(+), 42 deletions(-) diff --git a/__tests__/ExpensiMark-HTML-test.js b/__tests__/ExpensiMark-HTML-test.js index c02cdb152..1c2806a04 100644 --- a/__tests__/ExpensiMark-HTML-test.js +++ b/__tests__/ExpensiMark-HTML-test.js @@ -340,7 +340,7 @@ test('Test markdown replacement for emojis with emails', () => { '[😄 abc@gmail.com ](abc@gmail.com) '; const result = 'Replace the emoji with link ' + - '😄 ' + + '😄 ' + '[😄]( abc@gmail.com) ' + '[😄] abc@gmail.com ' + '[😄]((abc@gmail.com)) ' + @@ -1051,7 +1051,7 @@ test('Test markdown and url links with inconsistent starting and closing parens' test('Test link: Keep spaces at both end for shouldKeepRawInput=true', () => { const testString = '[ link ](https://www.expensify.com)'; - const resultString = ' link '; + const resultString = ' link '; expect(parser.replace(testString, {shouldKeepRawInput: true})).toBe(resultString); }); @@ -2136,7 +2136,8 @@ describe('Video markdown conversion to html tag', () => { test('Text containing videos', () => { const testString = 'A video of a banana: ![banana](https://example.com/banana.mp4) a video without name: !(https://example.com/developer.mp4)'; - const resultString = 'A video of a banana: a video without name: '; + const resultString = + 'A video of a banana: a video without name: '; expect(parser.replace(testString)).toBe(resultString); }); @@ -2144,35 +2145,40 @@ describe('Video markdown conversion to html tag', () => { const testString = '![test](https://example.com/video.mp4)'; const resultString = ''; expect(parser.replace(testString, {shouldKeepRawInput: true})).toBe(resultString); - }) + }); test('Single video with extra cached attributes with videoAttributeCache', () => { const testString = '![test](https://example.com/video.mp4)'; const resultString = ''; - expect(parser.replace(testString, { - extras: { - videoAttributeCache: { - 'https://example.com/video.mp4': 'data-expensify-height="100" data-expensify-width="100"' - } - } - })).toBe(resultString); - }) + expect( + parser.replace(testString, { + extras: { + videoAttributeCache: { + 'https://example.com/video.mp4': 'data-expensify-height="100" data-expensify-width="100"', + }, + }, + }), + ).toBe(resultString); + }); test('Single video with extra cached attributes with mediaAttributeCache', () => { const testString = '![test](https://example.com/video.mp4)'; const resultString = ''; - expect(parser.replace(testString, { - extras: { - mediaAttributeCache: { - 'https://example.com/video.mp4': 'data-expensify-height="100" data-expensify-width="100"' - } - } - })).toBe(resultString); - }) + expect( + parser.replace(testString, { + extras: { + mediaAttributeCache: { + 'https://example.com/video.mp4': 'data-expensify-height="100" data-expensify-width="100"', + }, + }, + }), + ).toBe(resultString); + }); test('Text containing image and video', () => { const testString = 'An image of a banana: ![banana](https://example.com/banana.png) and a video of a banana: ![banana](https://example.com/banana.mp4)'; - const resultString = 'An image of a banana: banana and a video of a banana: '; + const resultString = + 'An image of a banana: banana and a video of a banana: '; expect(parser.replace(testString)).toBe(resultString); }); @@ -2193,9 +2199,7 @@ describe('Video markdown conversion to html tag', () => { const resultString = ''; expect(parser.replace(testString)).toBe(resultString); }); - - -}) +}); describe('Image markdown conversion to html tag', () => { test('Single image with alt text', () => { @@ -2285,27 +2289,30 @@ describe('Image markdown conversion to html tag', () => { test('Single image with extra cached attributes using mediaAttributeCache', () => { const testString = '![test](https://example.com/image.jpg)'; const resultString = 'test'; - expect(parser.replace(testString, { - extras: { - mediaAttributeCache: { - 'https://example.com/image.jpg': 'data-expensify-height="100" data-expensify-width="100"' - } - } - })).toBe(resultString); - }) + expect( + parser.replace(testString, { + extras: { + mediaAttributeCache: { + 'https://example.com/image.jpg': 'data-expensify-height="100" data-expensify-width="100"', + }, + }, + }), + ).toBe(resultString); + }); test('Single image with extra cached attributes using videAttributeCache', () => { const testString = '![test](https://example.com/image.jpg)'; const resultString = 'test'; - expect(parser.replace(testString, { - extras: { - videoAttributeCache: { - 'https://example.com/image.jpg': 'data-expensify-height="100" data-expensify-width="100"' - } - } - })).toBe(resultString); - }) - + expect( + parser.replace(testString, { + extras: { + videoAttributeCache: { + 'https://example.com/image.jpg': 'data-expensify-height="100" data-expensify-width="100"', + }, + }, + }), + ).toBe(resultString); + }); }); describe('room mentions', () => { @@ -2320,10 +2327,15 @@ describe('room mentions', () => { const resultString = 'hi all #room'; expect(parser.replace(testString)).toBe(resultString); }); + test('room mention with any leading character', () => { + const testString = 'a#room 1#room :#room'; + const resultString = 'a#room 1#room :#room'; + expect(parser.replace(testString)).toBe(resultString); + }); test('room mention with leading word and no space', () => { const testString = 'hi all#room'; - const resultString = 'hi all#room'; + const resultString = 'hi all#room'; expect(parser.replace(testString)).toBe(resultString); }); From 219587690f6e02939ecff607bf55c7bae44440c3 Mon Sep 17 00:00:00 2001 From: truph01 Date: Tue, 1 Apr 2025 00:15:30 +0700 Subject: [PATCH 3/7] fix: revert test --- __tests__/ExpensiMark-HTML-test.js | 73 ++++++++++++++---------------- 1 file changed, 34 insertions(+), 39 deletions(-) diff --git a/__tests__/ExpensiMark-HTML-test.js b/__tests__/ExpensiMark-HTML-test.js index 1c2806a04..4cf8ed012 100644 --- a/__tests__/ExpensiMark-HTML-test.js +++ b/__tests__/ExpensiMark-HTML-test.js @@ -340,7 +340,7 @@ test('Test markdown replacement for emojis with emails', () => { '[😄 abc@gmail.com ](abc@gmail.com) '; const result = 'Replace the emoji with link ' + - '😄 ' + + '😄 ' + '[😄]( abc@gmail.com) ' + '[😄] abc@gmail.com ' + '[😄]((abc@gmail.com)) ' + @@ -1051,7 +1051,7 @@ test('Test markdown and url links with inconsistent starting and closing parens' test('Test link: Keep spaces at both end for shouldKeepRawInput=true', () => { const testString = '[ link ](https://www.expensify.com)'; - const resultString = ' link '; + const resultString = ' link '; expect(parser.replace(testString, {shouldKeepRawInput: true})).toBe(resultString); }); @@ -2136,8 +2136,7 @@ describe('Video markdown conversion to html tag', () => { test('Text containing videos', () => { const testString = 'A video of a banana: ![banana](https://example.com/banana.mp4) a video without name: !(https://example.com/developer.mp4)'; - const resultString = - 'A video of a banana: a video without name: '; + const resultString = 'A video of a banana: a video without name: '; expect(parser.replace(testString)).toBe(resultString); }); @@ -2145,40 +2144,35 @@ describe('Video markdown conversion to html tag', () => { const testString = '![test](https://example.com/video.mp4)'; const resultString = ''; expect(parser.replace(testString, {shouldKeepRawInput: true})).toBe(resultString); - }); + }) test('Single video with extra cached attributes with videoAttributeCache', () => { const testString = '![test](https://example.com/video.mp4)'; const resultString = ''; - expect( - parser.replace(testString, { - extras: { - videoAttributeCache: { - 'https://example.com/video.mp4': 'data-expensify-height="100" data-expensify-width="100"', - }, - }, - }), - ).toBe(resultString); - }); + expect(parser.replace(testString, { + extras: { + videoAttributeCache: { + 'https://example.com/video.mp4': 'data-expensify-height="100" data-expensify-width="100"' + } + } + })).toBe(resultString); + }) test('Single video with extra cached attributes with mediaAttributeCache', () => { const testString = '![test](https://example.com/video.mp4)'; const resultString = ''; - expect( - parser.replace(testString, { - extras: { - mediaAttributeCache: { - 'https://example.com/video.mp4': 'data-expensify-height="100" data-expensify-width="100"', - }, - }, - }), - ).toBe(resultString); - }); + expect(parser.replace(testString, { + extras: { + mediaAttributeCache: { + 'https://example.com/video.mp4': 'data-expensify-height="100" data-expensify-width="100"' + } + } + })).toBe(resultString); + }) test('Text containing image and video', () => { const testString = 'An image of a banana: ![banana](https://example.com/banana.png) and a video of a banana: ![banana](https://example.com/banana.mp4)'; - const resultString = - 'An image of a banana: banana and a video of a banana: '; + const resultString = 'An image of a banana: banana and a video of a banana: '; expect(parser.replace(testString)).toBe(resultString); }); @@ -2199,7 +2193,9 @@ describe('Video markdown conversion to html tag', () => { const resultString = ''; expect(parser.replace(testString)).toBe(resultString); }); -}); + + +}) describe('Image markdown conversion to html tag', () => { test('Single image with alt text', () => { @@ -2303,16 +2299,15 @@ describe('Image markdown conversion to html tag', () => { test('Single image with extra cached attributes using videAttributeCache', () => { const testString = '![test](https://example.com/image.jpg)'; const resultString = 'test'; - expect( - parser.replace(testString, { - extras: { - videoAttributeCache: { - 'https://example.com/image.jpg': 'data-expensify-height="100" data-expensify-width="100"', - }, - }, - }), - ).toBe(resultString); - }); + expect(parser.replace(testString, { + extras: { + videoAttributeCache: { + 'https://example.com/image.jpg': 'data-expensify-height="100" data-expensify-width="100"' + } + } + })).toBe(resultString); + }) + }); describe('room mentions', () => { @@ -2335,7 +2330,7 @@ describe('room mentions', () => { test('room mention with leading word and no space', () => { const testString = 'hi all#room'; - const resultString = 'hi all#room'; + const resultString = 'hi all#room'; expect(parser.replace(testString)).toBe(resultString); }); From 5f10220edfc2eb27a4cf1f2d7d907d5c8630d5e8 Mon Sep 17 00:00:00 2001 From: truph01 Date: Tue, 1 Apr 2025 00:16:33 +0700 Subject: [PATCH 4/7] fix: removed redundant change --- __tests__/ExpensiMark-HTML-test.js | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/__tests__/ExpensiMark-HTML-test.js b/__tests__/ExpensiMark-HTML-test.js index 4cf8ed012..64165c6f0 100644 --- a/__tests__/ExpensiMark-HTML-test.js +++ b/__tests__/ExpensiMark-HTML-test.js @@ -2285,16 +2285,14 @@ describe('Image markdown conversion to html tag', () => { test('Single image with extra cached attributes using mediaAttributeCache', () => { const testString = '![test](https://example.com/image.jpg)'; const resultString = 'test'; - expect( - parser.replace(testString, { - extras: { - mediaAttributeCache: { - 'https://example.com/image.jpg': 'data-expensify-height="100" data-expensify-width="100"', - }, - }, - }), - ).toBe(resultString); - }); + expect(parser.replace(testString, { + extras: { + mediaAttributeCache: { + 'https://example.com/image.jpg': 'data-expensify-height="100" data-expensify-width="100"' + } + } + })).toBe(resultString); + }) test('Single image with extra cached attributes using videAttributeCache', () => { const testString = '![test](https://example.com/image.jpg)'; From 97bf04bb3aa9352b3c96b9538ab3d7d60de8eead Mon Sep 17 00:00:00 2001 From: truph01 Date: Tue, 1 Apr 2025 00:19:41 +0700 Subject: [PATCH 5/7] fix: update test --- __tests__/ExpensiMark-HTML-test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/__tests__/ExpensiMark-HTML-test.js b/__tests__/ExpensiMark-HTML-test.js index 64165c6f0..2734e2f48 100644 --- a/__tests__/ExpensiMark-HTML-test.js +++ b/__tests__/ExpensiMark-HTML-test.js @@ -2328,7 +2328,7 @@ describe('room mentions', () => { test('room mention with leading word and no space', () => { const testString = 'hi all#room'; - const resultString = 'hi all#room'; + const resultString = 'hi all#room'; expect(parser.replace(testString)).toBe(resultString); }); From b4f590c2a73dd271c03df8aad34dc91f90bab851 Mon Sep 17 00:00:00 2001 From: truph01 Date: Mon, 21 Apr 2025 19:56:51 +0700 Subject: [PATCH 6/7] fix: update regex --- __tests__/ExpensiMark-HTML-test.js | 97 ++++++++++++++++-------------- lib/ExpensiMark.ts | 2 +- 2 files changed, 53 insertions(+), 46 deletions(-) diff --git a/__tests__/ExpensiMark-HTML-test.js b/__tests__/ExpensiMark-HTML-test.js index 2734e2f48..4607c2f61 100644 --- a/__tests__/ExpensiMark-HTML-test.js +++ b/__tests__/ExpensiMark-HTML-test.js @@ -340,7 +340,7 @@ test('Test markdown replacement for emojis with emails', () => { '[😄 abc@gmail.com ](abc@gmail.com) '; const result = 'Replace the emoji with link ' + - '😄 ' + + '😄 ' + '[😄]( abc@gmail.com) ' + '[😄] abc@gmail.com ' + '[😄]((abc@gmail.com)) ' + @@ -1051,7 +1051,7 @@ test('Test markdown and url links with inconsistent starting and closing parens' test('Test link: Keep spaces at both end for shouldKeepRawInput=true', () => { const testString = '[ link ](https://www.expensify.com)'; - const resultString = ' link '; + const resultString = ' link '; expect(parser.replace(testString, {shouldKeepRawInput: true})).toBe(resultString); }); @@ -2136,7 +2136,8 @@ describe('Video markdown conversion to html tag', () => { test('Text containing videos', () => { const testString = 'A video of a banana: ![banana](https://example.com/banana.mp4) a video without name: !(https://example.com/developer.mp4)'; - const resultString = 'A video of a banana: a video without name: '; + const resultString = + 'A video of a banana: a video without name: '; expect(parser.replace(testString)).toBe(resultString); }); @@ -2144,35 +2145,40 @@ describe('Video markdown conversion to html tag', () => { const testString = '![test](https://example.com/video.mp4)'; const resultString = ''; expect(parser.replace(testString, {shouldKeepRawInput: true})).toBe(resultString); - }) + }); test('Single video with extra cached attributes with videoAttributeCache', () => { const testString = '![test](https://example.com/video.mp4)'; const resultString = ''; - expect(parser.replace(testString, { - extras: { - videoAttributeCache: { - 'https://example.com/video.mp4': 'data-expensify-height="100" data-expensify-width="100"' - } - } - })).toBe(resultString); - }) + expect( + parser.replace(testString, { + extras: { + videoAttributeCache: { + 'https://example.com/video.mp4': 'data-expensify-height="100" data-expensify-width="100"', + }, + }, + }), + ).toBe(resultString); + }); test('Single video with extra cached attributes with mediaAttributeCache', () => { const testString = '![test](https://example.com/video.mp4)'; const resultString = ''; - expect(parser.replace(testString, { - extras: { - mediaAttributeCache: { - 'https://example.com/video.mp4': 'data-expensify-height="100" data-expensify-width="100"' - } - } - })).toBe(resultString); - }) + expect( + parser.replace(testString, { + extras: { + mediaAttributeCache: { + 'https://example.com/video.mp4': 'data-expensify-height="100" data-expensify-width="100"', + }, + }, + }), + ).toBe(resultString); + }); test('Text containing image and video', () => { const testString = 'An image of a banana: ![banana](https://example.com/banana.png) and a video of a banana: ![banana](https://example.com/banana.mp4)'; - const resultString = 'An image of a banana: banana and a video of a banana: '; + const resultString = + 'An image of a banana: banana and a video of a banana: '; expect(parser.replace(testString)).toBe(resultString); }); @@ -2193,9 +2199,7 @@ describe('Video markdown conversion to html tag', () => { const resultString = ''; expect(parser.replace(testString)).toBe(resultString); }); - - -}) +}); describe('Image markdown conversion to html tag', () => { test('Single image with alt text', () => { @@ -2285,27 +2289,30 @@ describe('Image markdown conversion to html tag', () => { test('Single image with extra cached attributes using mediaAttributeCache', () => { const testString = '![test](https://example.com/image.jpg)'; const resultString = 'test'; - expect(parser.replace(testString, { - extras: { - mediaAttributeCache: { - 'https://example.com/image.jpg': 'data-expensify-height="100" data-expensify-width="100"' - } - } - })).toBe(resultString); - }) + expect( + parser.replace(testString, { + extras: { + mediaAttributeCache: { + 'https://example.com/image.jpg': 'data-expensify-height="100" data-expensify-width="100"', + }, + }, + }), + ).toBe(resultString); + }); test('Single image with extra cached attributes using videAttributeCache', () => { const testString = '![test](https://example.com/image.jpg)'; const resultString = 'test'; - expect(parser.replace(testString, { - extras: { - videoAttributeCache: { - 'https://example.com/image.jpg': 'data-expensify-height="100" data-expensify-width="100"' - } - } - })).toBe(resultString); - }) - + expect( + parser.replace(testString, { + extras: { + videoAttributeCache: { + 'https://example.com/image.jpg': 'data-expensify-height="100" data-expensify-width="100"', + }, + }, + }), + ).toBe(resultString); + }); }); describe('room mentions', () => { @@ -2320,15 +2327,15 @@ describe('room mentions', () => { const resultString = 'hi all #room'; expect(parser.replace(testString)).toBe(resultString); }); - test('room mention with any leading character', () => { - const testString = 'a#room 1#room :#room'; - const resultString = 'a#room 1#room :#room'; + test('room mention with : as leading character', () => { + const testString = ':#room'; + const resultString = ':#room'; expect(parser.replace(testString)).toBe(resultString); }); test('room mention with leading word and no space', () => { const testString = 'hi all#room'; - const resultString = 'hi all#room'; + const resultString = 'hi all#room'; expect(parser.replace(testString)).toBe(resultString); }); diff --git a/lib/ExpensiMark.ts b/lib/ExpensiMark.ts index 2c1739d57..8c2c6ea71 100644 --- a/lib/ExpensiMark.ts +++ b/lib/ExpensiMark.ts @@ -350,7 +350,7 @@ export default class ExpensiMark { { name: 'reportMentions', - regex: /(?<=^|[*~_]?|[ \n][*~_]?)(#[\p{Ll}0-9-]{1,99})(?![^<]*(?:<\/pre>|<\/code>|<\/a>))/gimu, + regex: /(?<=^[*~_:]?|[ \n][*~_:]?|[:#])(#[\p{Ll}0-9-]{1,99})(?![^<]*(?:<\/pre>|<\/code>|<\/a>))/gimu, replacement: '$1', }, From 0f78ac6b8de69e84400a43f31b381f596522ef6b Mon Sep 17 00:00:00 2001 From: truph01 Date: Mon, 21 Apr 2025 19:58:03 +0700 Subject: [PATCH 7/7] fix: revert test --- __tests__/ExpensiMark-HTML-test.js | 89 ++++++++++++++---------------- 1 file changed, 41 insertions(+), 48 deletions(-) diff --git a/__tests__/ExpensiMark-HTML-test.js b/__tests__/ExpensiMark-HTML-test.js index 4607c2f61..a8dd0080a 100644 --- a/__tests__/ExpensiMark-HTML-test.js +++ b/__tests__/ExpensiMark-HTML-test.js @@ -340,7 +340,7 @@ test('Test markdown replacement for emojis with emails', () => { '[😄 abc@gmail.com ](abc@gmail.com) '; const result = 'Replace the emoji with link ' + - '😄 ' + + '😄 ' + '[😄]( abc@gmail.com) ' + '[😄] abc@gmail.com ' + '[😄]((abc@gmail.com)) ' + @@ -1051,7 +1051,7 @@ test('Test markdown and url links with inconsistent starting and closing parens' test('Test link: Keep spaces at both end for shouldKeepRawInput=true', () => { const testString = '[ link ](https://www.expensify.com)'; - const resultString = ' link '; + const resultString = ' link '; expect(parser.replace(testString, {shouldKeepRawInput: true})).toBe(resultString); }); @@ -2136,8 +2136,7 @@ describe('Video markdown conversion to html tag', () => { test('Text containing videos', () => { const testString = 'A video of a banana: ![banana](https://example.com/banana.mp4) a video without name: !(https://example.com/developer.mp4)'; - const resultString = - 'A video of a banana: a video without name: '; + const resultString = 'A video of a banana: a video without name: '; expect(parser.replace(testString)).toBe(resultString); }); @@ -2145,40 +2144,35 @@ describe('Video markdown conversion to html tag', () => { const testString = '![test](https://example.com/video.mp4)'; const resultString = ''; expect(parser.replace(testString, {shouldKeepRawInput: true})).toBe(resultString); - }); + }) test('Single video with extra cached attributes with videoAttributeCache', () => { const testString = '![test](https://example.com/video.mp4)'; const resultString = ''; - expect( - parser.replace(testString, { - extras: { - videoAttributeCache: { - 'https://example.com/video.mp4': 'data-expensify-height="100" data-expensify-width="100"', - }, - }, - }), - ).toBe(resultString); - }); + expect(parser.replace(testString, { + extras: { + videoAttributeCache: { + 'https://example.com/video.mp4': 'data-expensify-height="100" data-expensify-width="100"' + } + } + })).toBe(resultString); + }) test('Single video with extra cached attributes with mediaAttributeCache', () => { const testString = '![test](https://example.com/video.mp4)'; const resultString = ''; - expect( - parser.replace(testString, { - extras: { - mediaAttributeCache: { - 'https://example.com/video.mp4': 'data-expensify-height="100" data-expensify-width="100"', - }, - }, - }), - ).toBe(resultString); - }); + expect(parser.replace(testString, { + extras: { + mediaAttributeCache: { + 'https://example.com/video.mp4': 'data-expensify-height="100" data-expensify-width="100"' + } + } + })).toBe(resultString); + }) test('Text containing image and video', () => { const testString = 'An image of a banana: ![banana](https://example.com/banana.png) and a video of a banana: ![banana](https://example.com/banana.mp4)'; - const resultString = - 'An image of a banana: banana and a video of a banana: '; + const resultString = 'An image of a banana: banana and a video of a banana: '; expect(parser.replace(testString)).toBe(resultString); }); @@ -2199,7 +2193,9 @@ describe('Video markdown conversion to html tag', () => { const resultString = ''; expect(parser.replace(testString)).toBe(resultString); }); -}); + + +}) describe('Image markdown conversion to html tag', () => { test('Single image with alt text', () => { @@ -2289,30 +2285,27 @@ describe('Image markdown conversion to html tag', () => { test('Single image with extra cached attributes using mediaAttributeCache', () => { const testString = '![test](https://example.com/image.jpg)'; const resultString = 'test'; - expect( - parser.replace(testString, { - extras: { - mediaAttributeCache: { - 'https://example.com/image.jpg': 'data-expensify-height="100" data-expensify-width="100"', - }, - }, - }), - ).toBe(resultString); - }); + expect(parser.replace(testString, { + extras: { + mediaAttributeCache: { + 'https://example.com/image.jpg': 'data-expensify-height="100" data-expensify-width="100"' + } + } + })).toBe(resultString); + }) test('Single image with extra cached attributes using videAttributeCache', () => { const testString = '![test](https://example.com/image.jpg)'; const resultString = 'test'; - expect( - parser.replace(testString, { - extras: { - videoAttributeCache: { - 'https://example.com/image.jpg': 'data-expensify-height="100" data-expensify-width="100"', - }, - }, - }), - ).toBe(resultString); - }); + expect(parser.replace(testString, { + extras: { + videoAttributeCache: { + 'https://example.com/image.jpg': 'data-expensify-height="100" data-expensify-width="100"' + } + } + })).toBe(resultString); + }) + }); describe('room mentions', () => {