aboutsummaryrefslogtreecommitdiffstats
path: root/skate
diff options
context:
space:
mode:
authorMartin Czygan <martin.czygan@gmail.com>2021-07-27 22:23:26 +0200
committerMartin Czygan <martin.czygan@gmail.com>2021-07-27 22:23:26 +0200
commit3078e0c4227b395ddec143c09004026bd057d0dd (patch)
tree12fd414e6c629a2b9a15ed6d6558b192e1d1f77b /skate
parentf7276804bf260d75baf82731eac6043dd281172e (diff)
downloadrefcat-3078e0c4227b395ddec143c09004026bd057d0dd.tar.gz
refcat-3078e0c4227b395ddec143c09004026bd057d0dd.zip
annotate test cases
Diffstat (limited to 'skate')
-rw-r--r--skate/reduce_test.go17
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",