From 2e744cd30fd350df1fb5397da4a699f62df30280 Mon Sep 17 00:00:00 2001 From: chaoqun <27287694+OpenWaygate@users.noreply.github.com> Date: Thu, 13 Jun 2024 21:17:05 +0800 Subject: [PATCH] :white_check_mark: Test for caption --- pkg/yutuber/caption/caption_test.go | 56 +++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 pkg/yutuber/caption/caption_test.go diff --git a/pkg/yutuber/caption/caption_test.go b/pkg/yutuber/caption/caption_test.go new file mode 100644 index 0000000..044c164 --- /dev/null +++ b/pkg/yutuber/caption/caption_test.go @@ -0,0 +1,56 @@ +package caption + +import ( + "reflect" + "testing" +) + +func TestNewCation(t *testing.T) { + type args struct { + opts []Option + } + tests := []struct { + name string + args args + want Caption + }{ + { + name: "TestNewCaption", + args: args{ + opts: []Option{ + WithId("id"), + WithFile("file"), + WithAudioTrackType("audioTrackType"), + WithIsAutoSynced(true), + WithIsCC(true), + WithIsDraft(true), + WithIsEasyReader(true), + WithIsLarge(true), + WithLanguage("language"), + WithName("name"), + }, + }, + want: &caption{ + id: "id", + file: "file", + audioTrackType: "audioTrackType", + isAutoSynced: &[]bool{true}[0], + isCC: &[]bool{true}[0], + isDraft: &[]bool{true}[0], + isEasyReader: &[]bool{true}[0], + isLarge: &[]bool{true}[0], + language: "language", + name: "name", + }, + }, + } + for _, tt := range tests { + t.Run( + tt.name, func(t *testing.T) { + if got := NewCation(tt.args.opts...); !reflect.DeepEqual(got, tt.want) { + t.Errorf("NewCation() = %v, want %v", got, tt.want) + } + }, + ) + } +}