49 lines
1.5 KiB
Go
49 lines
1.5 KiB
Go
package apimart
|
|
|
|
import (
|
|
"encoding/json"
|
|
"testing"
|
|
)
|
|
|
|
func TestVideoCapabilities(t *testing.T) {
|
|
capabilities, ok := VideoCapabilities("doubao-seedance-2.0")
|
|
if !ok {
|
|
t.Fatal("expected Seedance 2 capabilities")
|
|
}
|
|
if capabilities.ReferenceImages.MaxCount != 9 || capabilities.ReferenceAudios.MaxCount != 3 || capabilities.ReferenceVideos.MaxCount != 3 {
|
|
t.Fatalf("unexpected reference limits: %+v", capabilities)
|
|
}
|
|
}
|
|
|
|
func TestBuildSeedance2PayloadSupportsVideoAndAudioReferences(t *testing.T) {
|
|
input := json.RawMessage(`{
|
|
"prompt":"test",
|
|
"size":"16:9",
|
|
"duration":5,
|
|
"video_urls":["https://example.com/reference.mp4"],
|
|
"audio_urls":["https://example.com/reference.mp3"]
|
|
}`)
|
|
payload, err := BuildSeedance2Payload("doubao-seedance-2.0", input)
|
|
if err != nil {
|
|
t.Fatalf("BuildSeedance2Payload() error = %v", err)
|
|
}
|
|
if videos, ok := payload["video_urls"].([]string); !ok || len(videos) != 1 {
|
|
t.Fatalf("video_urls = %#v", payload["video_urls"])
|
|
}
|
|
if audios, ok := payload["audio_urls"].([]string); !ok || len(audios) != 1 {
|
|
t.Fatalf("audio_urls = %#v", payload["audio_urls"])
|
|
}
|
|
}
|
|
|
|
func TestBuildSeedance2PayloadRejectsTooManyVideos(t *testing.T) {
|
|
input := json.RawMessage(`{
|
|
"prompt":"test",
|
|
"size":"16:9",
|
|
"duration":5,
|
|
"video_urls":["https://example.com/1.mp4","https://example.com/2.mp4","https://example.com/3.mp4","https://example.com/4.mp4"]
|
|
}`)
|
|
if _, err := BuildSeedance2Payload("doubao-seedance-2.0", input); err == nil {
|
|
t.Fatal("expected too many reference videos to be rejected")
|
|
}
|
|
}
|