-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathconfig_test.go
78 lines (74 loc) · 1.46 KB
/
config_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
package salesforce
import (
"testing"
)
func TestConfiguration_SetDefaults(t *testing.T) {
expectedDefaults := Configuration{
CompressionHeaders: false,
}
tests := []struct {
name string
config *Configuration
want Configuration
}{
{
name: "set_defaults",
config: &Configuration{},
want: expectedDefaults,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
tt.config.SetDefaults()
if *tt.config != tt.want {
t.Errorf("Configuration.SetDefaults() = %v, want %v", *tt.config, expectedDefaults)
}
})
}
}
func TestConfiguration_SetCompressionHeaders(t *testing.T) {
type fields struct {
CompressionHeaders bool
}
type args struct {
compression bool
}
tests := []struct {
name string
fields fields
args args
want bool
}{
{
name: "set_compression_headers_true",
fields: fields{
CompressionHeaders: false,
},
args: args{
compression: true,
},
want: true,
},
{
name: "set_compression_headers_false",
fields: fields{
CompressionHeaders: true,
},
args: args{
compression: false,
},
want: false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
c := &Configuration{
CompressionHeaders: tt.fields.CompressionHeaders,
}
c.SetCompressionHeaders(tt.args.compression)
if c.CompressionHeaders != tt.want {
t.Errorf("Configuration.SetCompressionHeaders() = %v, want %v", c.CompressionHeaders, tt.want)
}
})
}
}