-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathecs_test.go
More file actions
44 lines (42 loc) · 754 Bytes
/
ecs_test.go
File metadata and controls
44 lines (42 loc) · 754 Bytes
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
package vresolver
import "testing"
func TestECS(t *testing.T) {
tests := []struct {
name string
file string
want string
}{
{
name: "empty file name file",
file: "",
want: "",
},
{
name: "non-existing file",
file: "ghost.json",
want: "",
},
{
name: "non-JSON file",
file: "./fixtures/ecs-non-json.html",
want: "",
},
{
name: "valid metadata file",
file: "./fixtures/ecs-metadata.json",
want: "2.4",
},
{
name: "valid metadata file but no tag",
file: "./fixtures/ecs-metadata-no-tag.json",
want: "",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := ECS(tt.file); got != tt.want {
t.Errorf("ECS() = %v, want %v", got, tt.want)
}
})
}
}