diff options
Diffstat (limited to 'skate/zippy_test.go')
-rw-r--r-- | skate/zippy_test.go | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/skate/zippy_test.go b/skate/zippy_test.go index d0ebbd4..3e64dd0 100644 --- a/skate/zippy_test.go +++ b/skate/zippy_test.go @@ -76,9 +76,11 @@ func TestUniqueMatches(t *testing.T) { { about: "a single doc is passed on", docs: []string{`{ + "_id": "s1_0", "source_release_ident": "s1", "target_release_ident": "t1"}`}, result: []*BiblioRef{&BiblioRef{ + Key: "s1_0", SourceReleaseIdent: "s1", TargetReleaseIdent: "t1", }}, @@ -87,14 +89,17 @@ func TestUniqueMatches(t *testing.T) { { about: "we want to keep the exact match, if available", docs: []string{` - {"source_release_ident": "s1", + {"_id": "s1_0", + "source_release_ident": "s1", "target_release_ident": "t1", "match_status": "fuzzy"}`, - `{"source_release_ident": "s1", + `{"_id": "s1_1", + "source_release_ident": "s1", "target_release_ident": "t1", "match_status": "exact"}`, }, result: []*BiblioRef{&BiblioRef{ + Key: "s1_1", SourceReleaseIdent: "s1", TargetReleaseIdent: "t1", MatchStatus: "exact", @@ -104,16 +109,19 @@ func TestUniqueMatches(t *testing.T) { { about: "if both are exact, we just take (any) one", docs: []string{` - {"source_release_ident": "s1", + {"_id": "s1_0", + "source_release_ident": "s1", "target_release_ident": "t1", "match_status": "exact", "match_reason": "a"}`, - `{"source_release_ident": "s1", + `{"_id": "s1_1", + "source_release_ident": "s1", "target_release_ident": "t1", "match_status": "exact", "match_reason": "b"}`, }, result: []*BiblioRef{&BiblioRef{ + Key: "s1_1", SourceReleaseIdent: "s1", TargetReleaseIdent: "t1", MatchStatus: "exact", @@ -237,6 +245,9 @@ func TestMatchedRefsExtend(t *testing.T) { } for i, c := range cases { result := matchedRefsExtend(c.matched, c.refs, &statsAugment{}) + for _, v := range result { + v.IndexedTs = "" // we do not want to mock out time, now + } if !reflect.DeepEqual(result, c.result) { t.Fatalf("[%d]: got %v, want %v (%v)", i+1, result, c.result, pretty.Diff(result, c.result)) |