-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcontainer_builder_test.go
More file actions
95 lines (78 loc) · 2.62 KB
/
container_builder_test.go
File metadata and controls
95 lines (78 loc) · 2.62 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
package threads
import "testing"
func TestContainerBuilder_SetIsGhostPost_TextMediaType(t *testing.T) {
b := NewContainerBuilder().
SetMediaType(MediaTypeText).
SetIsGhostPost(true)
params := b.Build()
if params.Get("is_ghost_post") != "true" {
t.Error("expected is_ghost_post to be set for TEXT media type")
}
}
func TestContainerBuilder_SetIsGhostPost_ImageMediaType_Ignored(t *testing.T) {
b := NewContainerBuilder().
SetMediaType(MediaTypeImage).
SetIsGhostPost(true)
params := b.Build()
if params.Get("is_ghost_post") != "" {
t.Error("expected is_ghost_post to be ignored for IMAGE media type")
}
}
func TestContainerBuilder_SetIsGhostPost_VideoMediaType_Ignored(t *testing.T) {
b := NewContainerBuilder().
SetMediaType(MediaTypeVideo).
SetIsGhostPost(true)
params := b.Build()
if params.Get("is_ghost_post") != "" {
t.Error("expected is_ghost_post to be ignored for VIDEO media type")
}
}
func TestContainerBuilder_SetIsGhostPost_CarouselMediaType_Ignored(t *testing.T) {
b := NewContainerBuilder().
SetMediaType(MediaTypeCarousel).
SetIsGhostPost(true)
params := b.Build()
if params.Get("is_ghost_post") != "" {
t.Error("expected is_ghost_post to be ignored for CAROUSEL media type")
}
}
func TestContainerBuilder_SetIsGhostPost_NoMediaType_ThenText(t *testing.T) {
// Ghost post set before media type; TEXT should preserve it
b := NewContainerBuilder().
SetIsGhostPost(true).
SetMediaType(MediaTypeText)
params := b.Build()
if params.Get("is_ghost_post") != "true" {
t.Error("expected is_ghost_post to be preserved when media_type is set to TEXT after")
}
}
func TestContainerBuilder_SetIsGhostPost_NoMediaType_ThenImage(t *testing.T) {
// Ghost post set before media type; IMAGE should clear it
b := NewContainerBuilder().
SetIsGhostPost(true).
SetMediaType(MediaTypeImage)
params := b.Build()
if params.Get("is_ghost_post") != "" {
t.Error("expected is_ghost_post to be cleared when media_type is set to IMAGE after")
}
}
func TestContainerBuilder_SetIsGhostPost_ToggleTrueToFalse(t *testing.T) {
// Setting true then false should clear the flag
b := NewContainerBuilder().
SetMediaType(MediaTypeText).
SetIsGhostPost(true).
SetIsGhostPost(false)
params := b.Build()
if params.Get("is_ghost_post") != "" {
t.Error("expected is_ghost_post to be cleared after SetIsGhostPost(false)")
}
}
func TestContainerBuilder_SetIsGhostPost_False_NotSet(t *testing.T) {
b := NewContainerBuilder().
SetMediaType(MediaTypeText).
SetIsGhostPost(false)
params := b.Build()
if params.Get("is_ghost_post") != "" {
t.Error("expected is_ghost_post to not be set when isGhostPost=false")
}
}