Skip to content

Commit a8939da

Browse files
authored
test(fetcher/cisco): fix test comparison by sorting cisco products (#460)
1 parent 24d3813 commit a8939da

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

fetcher/cisco/cisco_test.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"time"
77

88
"github.com/google/go-cmp/cmp"
9+
"github.com/google/go-cmp/cmp/cmpopts"
910

1011
"github.com/vulsio/go-cve-dictionary/models"
1112
)
@@ -278,7 +279,9 @@ func Test_convert(t *testing.T) {
278279
break
279280
}
280281

281-
if diff := cmp.Diff(want, got); diff != "" {
282+
if diff := cmp.Diff(want, got, cmpopts.SortSlices(func(a, b models.CiscoProduct) bool {
283+
return a.FormattedString < b.FormattedString
284+
})); diff != "" {
282285
t.Errorf("convert(). (-expected +got):\n%s", diff)
283286
}
284287
}

0 commit comments

Comments
 (0)