-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathblock_test.go
85 lines (68 loc) · 2 KB
/
block_test.go
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
package slack
import (
"fmt"
"net/url"
"testing"
)
func TestNewActionBlock(t *testing.T) {
t.Run("NewActionBlock", func(t *testing.T) {
action := NewAction()
output := action.Render()
t.Log(output)
})
}
func TestFileRender(t *testing.T) {
t.Run("valid file", func(t *testing.T) {
file := NewFile("externalId", "source")
file = file.AddBlockId("file1")
output := file.Render()
fmt.Println("File output: \n\n", output)
})
}
func TestHeader(t *testing.T) {
t.Run("valid header", func(t *testing.T) {
header := NewHeader("header text")
output := header.Render()
fmt.Println("Header output: \n\n", output)
})
}
func TestImage(t *testing.T) {
t.Run("valid image", func(t *testing.T) {
u, err := url.Parse("https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png")
if err != nil {
t.Error(err)
}
img := NewImage(u, "Google Logo")
output := img.Render()
fmt.Println("Image output: \n\n", output)
})
}
func TestNewInputTest(t *testing.T) {
t.Run("NewInputTest", func(t *testing.T) {
})
}
func TestVideo(t *testing.T) {
t.Run("NewVideo", func(t *testing.T) {
thumbNailUrl, err := url.Parse("https://i.ytimg.com/vi/RRxQQxiM7AA/hqdefault.jpg")
if err != nil {
t.Error(err)
}
videoUrl, err := url.Parse("https://www.youtube.com/embed/RRxQQxiM7AA?feature=oembed&autoplay=1")
if err != nil {
t.Error(err)
}
titleUrl, err := url.Parse("https://www.youtube.com/watch?v=RRxQQxiM7AA")
if err != nil {
t.Error(err)
}
providerIconUrl, err := url.Parse("https://www.example.com/provider_icon.jpg")
if err != nil {
t.Error(err)
}
video := NewVideo("title", thumbNailUrl, videoUrl, "How to use Slack?")
video = video.AddTitleUrl(titleUrl).AddProviderName("YouTube").AddAuthorName("Arcado Buendia").AddProviderIconUrl(providerIconUrl)
video = video.AddDescription("Slack is a new way to communicate with your team. It's faster, better organized and more secure than email.")
output := video.Render()
fmt.Println(Pretty(output))
})
}