From 174afe0085eb5b7e2a7eb572de8d5ed839bc643f Mon Sep 17 00:00:00 2001 From: Hongbo Wu Date: Wed, 5 Oct 2022 16:48:20 +0800 Subject: [PATCH] Add test for decimal point in a sentence --- .../text-to-speech/test/htmlToSsml.test.ts | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/packages/text-to-speech/test/htmlToSsml.test.ts b/packages/text-to-speech/test/htmlToSsml.test.ts index 3d2350378..4f53bdaf4 100644 --- a/packages/text-to-speech/test/htmlToSsml.test.ts +++ b/packages/text-to-speech/test/htmlToSsml.test.ts @@ -235,7 +235,7 @@ describe('convert HTML to Speech file', () => { title: 'Wang Yi at the UN; Fu Zhenghua sentenced; Nvidia China sales', options: TEST_OPTIONS, }) - expect(speechFile.utterances).to.have.lengthOf(19) + expect(speechFile.utterances).to.have.lengthOf(20) }) it('converts long utterances to multiple utterances', () => { @@ -271,4 +271,23 @@ describe('convert HTML to Speech file', () => { }) expect(speechFile.utterances).to.have.lengthOf(2) }) + + it('does not break on not decimal point in sentences', () => { + const html = `
+
+
+ If terms of the original $12.5 billion financing package remain the same, bankers may struggle to sell the risky Twitter buyout debt just as credit markets begin to crack, with yields at multiyear highs, they’re potentially on the hook for hundreds of millions of dollars of losses on the unsecured portion alone should they try to unload it to investors. +
+
+
+` + const speechFile = htmlToSpeechFile({ + content: html, + title: 'Test long sentence with decimal point', + options: TEST_OPTIONS, + }) + expect(speechFile.utterances[1].text).to.eql( + 'If terms of the original $12.5 billion financing package remain the same, bankers may struggle to sell the risky Twitter buyout debt just as credit markets begin to crack, with yields at multiyear highs, they’re potentially on the hook for hundreds of millions of dollars of losses on the unsecured portion alone should they try to unload it to investors.' + ) + }) })