feat: add script tts backend
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
package com.emotion.service;
|
||||
|
||||
import com.emotion.service.impl.TtsTaskServiceImpl;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
class TtsTaskServiceTest {
|
||||
|
||||
@Test
|
||||
@DisplayName("cleanText strips markdown and normalizes whitespace")
|
||||
void cleanTextStripsMarkdownAndNormalizesWhitespace() {
|
||||
String cleaned = TtsTaskServiceImpl.cleanText("# Title\n\n> **hello** `world` - ok");
|
||||
|
||||
assertEquals("Title hello world ok", cleaned);
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("cleanText returns empty string for null input")
|
||||
void cleanTextReturnsEmptyForNull() {
|
||||
assertEquals("", TtsTaskServiceImpl.cleanText(null));
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("TtsEngineResult exposes synthesis result fields")
|
||||
void ttsEngineResultExposesFields() {
|
||||
TtsEngineClient.TtsEngineResult result =
|
||||
new TtsEngineClient.TtsEngineResult(true, "/tmp/a.mp3", 1200L, null);
|
||||
|
||||
assertTrue(result.isSuccess());
|
||||
assertEquals("/tmp/a.mp3", result.getAudioPath());
|
||||
assertEquals(1200L, result.getDurationMs());
|
||||
assertNull(result.getErrorMessage());
|
||||
assertFalse(new TtsEngineClient.TtsEngineResult(false, null, null, "boom").isSuccess());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user