summaryrefslogtreecommitdiff
path: root/internal/audio/attribution_test.go
blob: 2e310b4c60c0704c5881a7098b3340e954c9c428 (plain)
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
package audio

import (
	"testing"
	"time"
)

func TestBuildAttribution(t *testing.T) {
	params := AttributionParams{
		Word:          "ябълка",
		Model:         "gpt-4o-mini-tts",
		Voice:         "alloy",
		Instruction:   "Speak clearly.",
		ProcessedText: "ябълка...",
		Speed:         1.25,
		GeneratedAt:   time.Date(2026, time.April, 1, 15, 4, 5, 0, time.UTC),
	}

	tests := []struct {
		name string
		got  string
		want string
	}{
		{
			name: "openai",
			got:  BuildOpenAIAttribution(params),
			want: "Audio generated by OpenAI TTS\n\n" +
				"Bulgarian word: ябълка\n" +
				"Model: gpt-4o-mini-tts\n" +
				"Voice: alloy\n" +
				"Speed: 1.25\n\n" +
				"Voice instructions:\nSpeak clearly.\n\n" +
				"Processed text sent to TTS: ябълка...\n\n" +
				"Generated at: 2026-04-01 15:04:05\n",
		},
		{
			name: "gemini",
			got:  BuildGeminiAttribution(params),
			want: "Audio generated by Google Gemini TTS\n\n" +
				"Bulgarian word: ябълка\n" +
				"Model: gpt-4o-mini-tts\n" +
				"Voice: alloy\n" +
				"Speed: 1.25\n\n" +
				"Voice instructions:\nSpeak clearly.\n\n" +
				"Processed text sent to TTS: ябълка...\n\n" +
				"Generated at: 2026-04-01 15:04:05\n",
		},
	}

	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			if tt.got != tt.want {
				t.Fatalf("unexpected attribution output\nwant:\n%q\n\ngot:\n%q", tt.want, tt.got)
			}
		})
	}
}