From c697b0cb4db61cd7b5c5bec9bacfde76cd038047 Mon Sep 17 00:00:00 2001 From: Hongbo Wu Date: Mon, 17 Apr 2023 19:13:09 +0800 Subject: [PATCH] Add test case --- .../text-to-speech/test/htmlToSsml.test.ts | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/packages/text-to-speech/test/htmlToSsml.test.ts b/packages/text-to-speech/test/htmlToSsml.test.ts index a2673f465..af0aa46cc 100644 --- a/packages/text-to-speech/test/htmlToSsml.test.ts +++ b/packages/text-to-speech/test/htmlToSsml.test.ts @@ -1,12 +1,12 @@ -import 'mocha' import { expect } from 'chai' +import * as fs from 'fs' +import 'mocha' +import path from 'path' import { htmlToSpeechFile, htmlToSsmlItems, stripEmojis, } from '../src/htmlToSsml' -import * as fs from 'fs' -import path from 'path' const TEST_OPTIONS = { primaryVoice: 'test-primary', @@ -309,4 +309,18 @@ describe('convert HTML to Speech file', () => { 'I feel like I’m working on reading, listening, and speaking all at once, sometimes I feel like I’m just getting surface understanding. ' ) }) + + it('splits sentences in German correctly', () => { + const html = `
+

Q: „Die kürzliche Razzia in den BBC-Büros in Delhi sind ein weiterer Versuch der Regierung, kritische Medien-Kommentare zu unterdrücken. Man hat des Gefühl, Herr Modi hat Angst, in den Spiegel zu schauen!?“

+
` + const speechFile = htmlToSpeechFile({ + content: html, + options: TEST_OPTIONS, + }) + expect(speechFile.utterances).to.have.lengthOf(1) + expect(speechFile.utterances[0].text).to.eql( + 'Q: „Die kürzliche Razzia in den BBC-Büros in Delhi sind ein weiterer Versuch der Regierung, kritische Medien-Kommentare zu unterdrücken. Man hat des Gefühl, Herr Modi hat Angst, in den Spiegel zu schauen!? “' + ) + }) })