-
Notifications
You must be signed in to change notification settings - Fork 0
/
composition_test.go
53 lines (46 loc) · 1.35 KB
/
composition_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
package flocksofblocks
import (
"fmt"
"testing"
)
func TestNewConfirmationDialog(t *testing.T) {
t.Run("NewConfirmationDialog", func(t *testing.T) {
confirm := NewConfirmationDialog("title", "text", "confirm", "deny")
if confirm.Render() == "" {
t.Error("failed to render")
}
confirm = confirm.SetStyle(StylePrimary)
if confirm.Render() == "" {
t.Error("failed to render")
}
fmt.Println(confirm.Render())
})
}
func TestNewDispatchActionConfig(t *testing.T) {
t.Run("NewDispatchActionConfig", func(t *testing.T) {
dispatchActionConfig := NewDispatchActionConfig().OnEnterPressed().OnCharacterEntered()
output := dispatchActionConfig.Render()
fmt.Println(output)
})
}
const (
outputValidFilter = `"filter": {
"include": ["im","mpim"],
"exclude_external_shared_channels": true
}`
)
func TestNewFilter(t *testing.T) {
t.Run("should return a new filter", func(t *testing.T) {
filter := NewFilter()
if filter.Render() != "" {
t.Errorf("Expected empty string, got %s", filter.Render())
}
filter = filter.IncludeIM().IncludeMPIM().ExcludeExternalSharedChannels()
if filter.Render() != outputValidFilter {
t.Errorf("Expected %s, got %s", outputValidFilter, filter.Render())
}
filter = filter.ExcludeBotUsers().IncludeIM().IncludeMPIM().ExcludeExternalSharedChannels()
output := filter.Render()
fmt.Println(output)
})
}