-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaudioisolation_test.go
More file actions
66 lines (55 loc) · 1.7 KB
/
audioisolation_test.go
File metadata and controls
66 lines (55 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
package elevenlabs
import (
"context"
"strings"
"testing"
)
func TestAudioIsolationRequestValidation(t *testing.T) {
client, _ := NewClient()
ctx := context.Background()
// Test nil audio
_, err := client.AudioIsolation().Isolate(ctx, &AudioIsolationRequest{})
if err == nil {
t.Error("Isolate() with nil audio should return error")
}
var valErr *ValidationError
if !isValidationError(err, &valErr) {
t.Errorf("Expected ValidationError, got %T", err)
}
if valErr.Field != "audio" {
t.Errorf("ValidationError field = %s, want audio", valErr.Field)
}
}
func TestAudioIsolationService(t *testing.T) {
client, _ := NewClient()
// Test that service is accessible
if client.AudioIsolation() == nil {
t.Error("AudioIsolation() returned nil")
}
}
func TestIsolateFile(t *testing.T) {
client, _ := NewClient()
ctx := context.Background()
// Test with valid parameters (will fail at API but pass validation)
audio := strings.NewReader("fake audio data")
_, err := client.AudioIsolation().IsolateFile(ctx, audio, "test.mp3")
// This will fail because we don't have a real API key or valid audio
// but it tests that the method exists and accepts the right parameters
if err == nil {
// If no error, the service would be making a real API call
t.Log("IsolateFile() called successfully")
}
}
func TestIsolateStream(t *testing.T) {
client, _ := NewClient()
ctx := context.Background()
// Test nil audio for stream
_, err := client.AudioIsolation().IsolateStream(ctx, &AudioIsolationRequest{})
if err == nil {
t.Error("IsolateStream() with nil audio should return error")
}
var valErr *ValidationError
if !isValidationError(err, &valErr) {
t.Errorf("Expected ValidationError, got %T", err)
}
}