diff options
Diffstat (limited to 'skate')
-rw-r--r-- | skate/reduce_test.go | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/skate/reduce_test.go b/skate/reduce_test.go index 7cde68f..78939a1 100644 --- a/skate/reduce_test.go +++ b/skate/reduce_test.go @@ -42,10 +42,12 @@ func TestUniqueMatches(t *testing.T) { err error }{ { - about: "missing fields are ignored", - docs: []string{`{}`}, - result: []*BiblioRef{&BiblioRef{}}, - err: nil, + about: "missing fields are ignored, but a biblioref document is created nonetheless", + docs: []string{`{}`}, + result: []*BiblioRef{ + &BiblioRef{}, + }, + err: nil, }, { about: "a single doc is passed on", @@ -104,7 +106,7 @@ func TestUniqueMatches(t *testing.T) { err: nil, }, { - about: "regression; a buggy sort?", + about: "regression; probably caused by a buggy match reason comparison", docs: []string{` {"_id": "s1_0", "source_release_ident": "s1", @@ -142,16 +144,19 @@ func TestUniqueMatches(t *testing.T) { func TestMatchedRefsExtend(t *testing.T) { var cases = []struct { + about string matched []*BiblioRef refs []*Ref result []*BiblioRef }{ { + about: "nothing to extend", matched: []*BiblioRef{}, refs: []*Ref{}, result: []*BiblioRef{}, }, { + about: "matched docs are carried over", matched: []*BiblioRef{ &BiblioRef{ RefIndex: 2, @@ -167,6 +172,7 @@ func TestMatchedRefsExtend(t *testing.T) { }, }, { + about: "two unrelated docs get merged", matched: []*BiblioRef{ &BiblioRef{ SourceReleaseIdent: "pud5shsflfgrth77lmlernavjm", @@ -234,6 +240,7 @@ func TestMatchedRefsExtend(t *testing.T) { }, }, { + about: "here, the bref will match the key and index of ref, hence we keep the bref", matched: []*BiblioRef{ &BiblioRef{ SourceReleaseIdent: "pud5shsflfgrth77lmlernavjm", |