Add test for label.go

This commit is contained in:
Theresa Gresch 2020-01-27 15:26:48 +01:00
parent 4471a2e07f
commit 0868f2a2d2

View file

@ -152,11 +152,13 @@ func TestLabels_Less(t *testing.T) {
}
func TestLabels_Keywords(t *testing.T) {
cat := Label{Name: "cat", Source: "location", Uncertainty: 59, Priority: 5}
dog := Label{Name: "dog", Source: "location", Uncertainty: 10, Priority: 5}
cat := Label{Name: "cat", Source: "location", Uncertainty: 59, Priority: 5, Categories: []string{"animal"}}
dog := Label{Name: "dog", Source: "location", Uncertainty: 10, Priority: 5, Categories: []string{"animal"}}
labels := Labels{cat, dog}
result := labels.Keywords()
assert.Equal(t, "cat", result[0])
assert.Equal(t, "dog", result[1])
assert.Equal(t, "animal", result[1])
assert.Equal(t, "dog", result[2])
assert.Equal(t, "animal", result[3])
}