Skip to content

Commit bbf51b8

Browse files
committed
✅ Fix tests for bool pointer
1 parent a11f427 commit bbf51b8

File tree

18 files changed

+65
-45
lines changed

18 files changed

+65
-45
lines changed

pkg/activity/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ go_test(
1616
name = "activity_test",
1717
srcs = ["activity_test.go"],
1818
embed = [":activity"],
19+
deps = ["//pkg/utils"],
1920
)

pkg/activity/activity_test.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package activity
22

33
import (
4+
"github.com/eat-pray-ai/yutu/pkg/utils"
45
"reflect"
56
"testing"
67
)
@@ -19,19 +20,19 @@ func TestNewActivity(t *testing.T) {
1920
args: args{
2021
opts: []Option{
2122
WithChannelId("ChannelId"),
22-
WithHome(true, true),
23+
WithHome(utils.BoolPtr("true")),
2324
WithMaxResults(10),
24-
WithMine(true, true),
25+
WithMine(utils.BoolPtr("true")),
2526
WithPublishedAfter("2021-01-01T00:00:00Z"),
2627
WithPublishedBefore("2021-01-31T00:00:00Z"),
2728
WithRegionCode("US"),
2829
},
2930
},
3031
want: &activity{
3132
ChannelId: "ChannelId",
32-
Home: &[]bool{true}[0],
33+
Home: utils.BoolPtr("true"),
3334
MaxResults: 10,
34-
Mine: &[]bool{true}[0],
35+
Mine: utils.BoolPtr("true"),
3536
PublishedAfter: "2021-01-01T00:00:00Z",
3637
PublishedBefore: "2021-01-31T00:00:00Z",
3738
RegionCode: "US",
@@ -41,11 +42,11 @@ func TestNewActivity(t *testing.T) {
4142
name: "TestNewActivity",
4243
args: args{
4344
opts: []Option{
44-
WithHome(false, true),
45+
WithHome(utils.BoolPtr("false")),
4546
},
4647
},
4748
want: &activity{
48-
Home: &[]bool{false}[0],
49+
Home: utils.BoolPtr("false"),
4950
},
5051
},
5152
{

pkg/caption/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ go_test(
1616
name = "caption_test",
1717
srcs = ["caption_test.go"],
1818
embed = [":caption"],
19+
deps = ["//pkg/utils"],
1920
)

pkg/caption/caption_test.go

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package caption
22

33
import (
4+
"github.com/eat-pray-ai/yutu/pkg/utils"
45
"reflect"
56
"testing"
67
)
@@ -21,11 +22,11 @@ func TestNewCation(t *testing.T) {
2122
WithID("ID"),
2223
WithFile("File"),
2324
WithAudioTrackType("AudioTrackType"),
24-
WithIsAutoSynced(true, true),
25-
WithIsCC(true, true),
26-
WithIsDraft(true, true),
27-
WithIsEasyReader(true, true),
28-
WithIsLarge(true, true),
25+
WithIsAutoSynced(utils.BoolPtr("true")),
26+
WithIsCC(utils.BoolPtr("true")),
27+
WithIsDraft(utils.BoolPtr("true")),
28+
WithIsEasyReader(utils.BoolPtr("true")),
29+
WithIsLarge(utils.BoolPtr("true")),
2930
WithLanguage("Language"),
3031
WithName("Name"),
3132
},
@@ -34,11 +35,11 @@ func TestNewCation(t *testing.T) {
3435
ID: "ID",
3536
File: "File",
3637
AudioTrackType: "AudioTrackType",
37-
IsAutoSynced: &[]bool{true}[0],
38-
IsCC: &[]bool{true}[0],
39-
IsDraft: &[]bool{true}[0],
40-
IsEasyReader: &[]bool{true}[0],
41-
IsLarge: &[]bool{true}[0],
38+
IsAutoSynced: utils.BoolPtr("true"),
39+
IsCC: utils.BoolPtr("true"),
40+
IsDraft: utils.BoolPtr("true"),
41+
IsEasyReader: utils.BoolPtr("true"),
42+
IsLarge: utils.BoolPtr("true"),
4243
Language: "Language",
4344
Name: "Name",
4445
},

pkg/channel/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ go_test(
1616
name = "channel_test",
1717
srcs = ["channel_test.go"],
1818
embed = [":channel"],
19+
deps = ["//pkg/utils"],
1920
)

pkg/channel/channel_test.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package channel
22

33
import (
4+
"github.com/eat-pray-ai/yutu/pkg/utils"
45
"reflect"
56
"testing"
67
)
@@ -23,10 +24,10 @@ func TestNewChannel(t *testing.T) {
2324
WithForUsername("username"),
2425
WithHl("hl"),
2526
WithID("id"),
26-
WithChannelManagedByMe(true, true),
27+
WithChannelManagedByMe(utils.BoolPtr("true")),
2728
WithMaxResults(5),
28-
WithMine(false, true),
29-
WithMySubscribers(true, true),
29+
WithMine(utils.BoolPtr("false")),
30+
WithMySubscribers(utils.BoolPtr("true")),
3031
WithOnBehalfOfContentOwner("contentOwner"),
3132
},
3233
},
@@ -36,10 +37,10 @@ func TestNewChannel(t *testing.T) {
3637
ForUsername: "username",
3738
Hl: "hl",
3839
ID: "id",
39-
ManagedByMe: &[]bool{true}[0],
40+
ManagedByMe: utils.BoolPtr("true"),
4041
MaxResults: 5,
41-
Mine: &[]bool{false}[0],
42-
MySubscribers: &[]bool{true}[0],
42+
Mine: utils.BoolPtr("false"),
43+
MySubscribers: utils.BoolPtr("true"),
4344
OnBehalfOfContentOwner: "contentOwner",
4445
},
4546
},

pkg/channelSection/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ go_test(
1616
name = "channelSection_test",
1717
srcs = ["channelSection_test.go"],
1818
embed = [":channelSection"],
19+
deps = ["//pkg/utils"],
1920
)

pkg/channelSection/channelSection_test.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package channelSection
22

33
import (
4+
"github.com/eat-pray-ai/yutu/pkg/utils"
45
"reflect"
56
"testing"
67
)
@@ -20,22 +21,24 @@ func TestNewChannelSection(t *testing.T) {
2021
opts: []Option{
2122
WithChannelId("channelId"),
2223
WithHl("hl"),
23-
WithMine(true, true),
24+
WithMine(utils.BoolPtr("true")),
2425
WithOnBehalfOfContentOwner("contentOwner"),
2526
},
2627
},
2728
want: &channelSection{
2829
ChannelId: "channelId",
2930
Hl: "hl",
30-
Mine: &[]bool{true}[0],
31+
Mine: utils.BoolPtr("true"),
3132
OnBehalfOfContentOwner: "contentOwner",
3233
},
3334
},
3435
}
3536
for _, tt := range tests {
3637
t.Run(
3738
tt.name, func(t *testing.T) {
38-
if got := NewChannelSection(tt.args.opts...); !reflect.DeepEqual(got, tt.want) {
39+
if got := NewChannelSection(tt.args.opts...); !reflect.DeepEqual(
40+
got, tt.want,
41+
) {
3942
t.Errorf("NewChannelSection() = %v, want %v", got, tt.want)
4043
}
4144
},

pkg/comment/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ go_test(
1616
name = "comment_test",
1717
srcs = ["comment_test.go"],
1818
embed = [":comment"],
19+
deps = ["//pkg/utils"],
1920
)

pkg/comment/comment_test.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package comment
22

33
import (
4+
"github.com/eat-pray-ai/yutu/pkg/utils"
45
"reflect"
56
"testing"
67
)
@@ -20,29 +21,29 @@ func TestNewComment(t *testing.T) {
2021
opts: []Option{
2122
WithIDs([]string{"id1", "id2"}),
2223
WithAuthorChannelId("authorChannelId"),
23-
WithCanRate(true, true),
24+
WithCanRate(utils.BoolPtr("true")),
2425
WithChannelId("channelId"),
2526
WithMaxResults(5),
2627
WithParentId("parentId"),
2728
WithTextFormat("html"),
2829
WithTextOriginal("textOriginal"),
2930
WithModerationStatus("heldForReview"),
30-
WithBanAuthor(true, true),
31+
WithBanAuthor(utils.BoolPtr("true")),
3132
WithVideoId("videoId"),
3233
WithViewerRating("like"),
3334
},
3435
},
3536
want: &comment{
3637
IDs: []string{"id1", "id2"},
3738
AuthorChannelId: "authorChannelId",
38-
CanRate: &[]bool{true}[0],
39+
CanRate: utils.BoolPtr("true"),
3940
ChannelId: "channelId",
4041
MaxResults: 5,
4142
ParentId: "parentId",
4243
TextFormat: "html",
4344
TextOriginal: "textOriginal",
4445
ModerationStatus: "heldForReview",
45-
BanAuthor: &[]bool{true}[0],
46+
BanAuthor: utils.BoolPtr("true"),
4647
VideoId: "videoId",
4748
ViewerRating: "like",
4849
},

pkg/playlist/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ go_test(
1616
name = "playlist_test",
1717
srcs = ["playlist_test.go"],
1818
embed = [":playlist"],
19+
deps = ["//pkg/utils"],
1920
)

pkg/playlist/playlist_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package playlist
22

33
import (
4+
"github.com/eat-pray-ai/yutu/pkg/utils"
45
"reflect"
56
"testing"
67
)
@@ -23,7 +24,7 @@ func TestNewPlaylist(t *testing.T) {
2324
WithDescription("description"),
2425
WithHl("hl"),
2526
WithMaxResults(5),
26-
WithMine(true, true),
27+
WithMine(utils.BoolPtr("true")),
2728
WithTags([]string{"tag1", "tag2"}),
2829
WithLanguage("language"),
2930
WithChannelId("channelId"),
@@ -38,7 +39,7 @@ func TestNewPlaylist(t *testing.T) {
3839
Description: "description",
3940
Hl: "hl",
4041
MaxResults: 5,
41-
Mine: &[]bool{true}[0],
42+
Mine: utils.BoolPtr("true"),
4243
Tags: []string{"tag1", "tag2"},
4344
Language: "language",
4445
ChannelId: "channelId",

pkg/search/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ go_test(
1616
name = "search_test",
1717
srcs = ["search_test.go"],
1818
embed = [":search"],
19+
deps = ["//pkg/utils"],
1920
)

pkg/search/search_test.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package search
22

33
import (
4+
"github.com/eat-pray-ai/yutu/pkg/utils"
45
"reflect"
56
"testing"
67
)
@@ -21,9 +22,9 @@ func TestNewSearch(t *testing.T) {
2122
WithChannelId("channelId"),
2223
WithChannelType("show"),
2324
WithEventType("live"),
24-
WithForContentOwner(true, true),
25-
WithForDeveloper(false, true),
26-
WithForMine(false, true),
25+
WithForContentOwner(utils.BoolPtr("true")),
26+
WithForDeveloper(utils.BoolPtr("false")),
27+
WithForMine(utils.BoolPtr("false")),
2728
WithLocation("location"),
2829
WithLocationRadius("radius"),
2930
WithMaxResults(10),
@@ -35,9 +36,9 @@ func TestNewSearch(t *testing.T) {
3536
ChannelId: "channelId",
3637
ChannelType: "show",
3738
EventType: "live",
38-
ForContentOwner: &[]bool{true}[0],
39-
ForDeveloper: &[]bool{false}[0],
40-
ForMine: &[]bool{false}[0],
39+
ForContentOwner: utils.BoolPtr("true"),
40+
ForDeveloper: utils.BoolPtr("false"),
41+
ForMine: utils.BoolPtr("false"),
4142
Location: "location",
4243
LocationRadius: "radius",
4344
MaxResults: 10,

pkg/subscription/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ go_test(
1616
name = "subscription_test",
1717
srcs = ["subscription_test.go"],
1818
embed = [":subscription"],
19+
deps = ["//pkg/utils"],
1920
)

pkg/subscription/subscription_test.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package subscription
22

33
import (
4+
"github.com/eat-pray-ai/yutu/pkg/utils"
45
"reflect"
56
"testing"
67
)
@@ -24,9 +25,9 @@ func TestNewSubscription(t *testing.T) {
2425
WithChannelId("channelId"),
2526
WithForChannelId("forChannelId"),
2627
WithMaxResults(10),
27-
WithMine(true, true),
28-
WithMyRecentSubscribers(false, true),
29-
WithMySubscribers(false, true),
28+
WithMine(utils.BoolPtr("true")),
29+
WithMyRecentSubscribers(utils.BoolPtr("false")),
30+
WithMySubscribers(utils.BoolPtr("false")),
3031
WithOnBehalfOfContentOwner("contentOwner"),
3132
WithOnBehalfOfContentOwnerChannel("contentOwnerChannel"),
3233
WithOrder("relevance"),
@@ -39,9 +40,9 @@ func TestNewSubscription(t *testing.T) {
3940
ChannelId: "channelId",
4041
ForChannelId: "forChannelId",
4142
MaxResults: 10,
42-
Mine: &[]bool{true}[0],
43-
MyRecentSubscribers: &[]bool{false}[0],
44-
MySubscribers: &[]bool{false}[0],
43+
Mine: utils.BoolPtr("true"),
44+
MyRecentSubscribers: utils.BoolPtr("false"),
45+
MySubscribers: utils.BoolPtr("false"),
4546
OnBehalfOfContentOwner: "contentOwner",
4647
OnBehalfOfContentOwnerChannel: "contentOwnerChannel",
4748
Order: "relevance",

pkg/video/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,5 @@ go_test(
1818
name = "video_test",
1919
srcs = ["video_test.go"],
2020
embed = [":video"],
21+
deps = ["//pkg/utils"],
2122
)

pkg/video/video_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package video
22

33
import (
4+
"github.com/eat-pray-ai/yutu/pkg/utils"
45
"reflect"
56
"testing"
67
)
@@ -19,7 +20,7 @@ func TestNewVideo(t *testing.T) {
1920
args: args{
2021
opts: []Option{
2122
WithID("id"),
22-
WithAutoLevels(true, true),
23+
WithAutoLevels(utils.BoolPtr("true")),
2324
WithFile("file"),
2425
WithTitle("title"),
2526
WithDescription("description"),
@@ -32,7 +33,7 @@ func TestNewVideo(t *testing.T) {
3233
},
3334
want: &video{
3435
ID: "id",
35-
AutoLevels: &[]bool{true}[0],
36+
AutoLevels: utils.BoolPtr("true"),
3637
File: "file",
3738
Title: "title",
3839
Description: "description",

0 commit comments

Comments
 (0)