From 3078e0c4227b395ddec143c09004026bd057d0dd Mon Sep 17 00:00:00 2001 From: Martin Czygan Date: Tue, 27 Jul 2021 22:23:26 +0200 Subject: annotate test cases --- skate/reduce_test.go | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'skate') 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", -- cgit v1.2.3