16 lines
475 B
Go
16 lines
475 B
Go
package tts
|
|
|
|
import "testing"
|
|
|
|
func TestParseAudioIgnoresControlJSON(t *testing.T) {
|
|
if got := parseAudio([]byte(`{"isFinal":true}`)); len(got) != 0 {
|
|
t.Fatalf("control json parsed as audio: %d bytes", len(got))
|
|
}
|
|
if got := parseAudio([]byte(`{"audio":"AQI="}`)); len(got) != 2 {
|
|
t.Fatalf("audio json not decoded: %d bytes", len(got))
|
|
}
|
|
if got := parseAudio([]byte{0, 1, 0, 1}); len(got) != 4 {
|
|
t.Fatalf("binary audio not passed through: %d bytes", len(got))
|
|
}
|
|
}
|