test(reconcile): a verdict returned with an error is not used
Mutation-testing showed the forced-unsure line was untested because my fake always returned unsure with its errors. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -277,3 +277,17 @@ func TestReconcile_ContestedSpotsAreCappedButTheCountsAreExact(t *testing.T) {
|
|||||||
assert.Equal(t, 300, out.Reconciliation.Disputes)
|
assert.Equal(t, 300, out.Reconciliation.Disputes)
|
||||||
assert.Len(t, out.Reconciliation.Contested, reconcile.MaxContested, "the stored list is bounded; the counts are not")
|
assert.Len(t, out.Reconciliation.Contested, reconcile.MaxContested, "the stored list is bounded; the counts are not")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestReconcile_AVerdictReturnedAlongsideAnErrorIsIgnored(t *testing.T) {
|
||||||
|
// An adjudicator that returns a verdict AND an error must not have the verdict used:
|
||||||
|
// the contract is that an error means no decision.
|
||||||
|
adj := &scripted{fn: func(int, reconcile.Request) (reconcile.Verdict, error) {
|
||||||
|
return reconcile.VerdictAlt, errors.New("half a reply")
|
||||||
|
}}
|
||||||
|
|
||||||
|
out := merge(t, tr("a x b"), tr("a y b"), adj)
|
||||||
|
|
||||||
|
assert.Equal(t, "a x b", out.Text, "no decision means the base stands")
|
||||||
|
assert.Zero(t, out.Reconciliation.Changed)
|
||||||
|
assert.Equal(t, 1, out.Reconciliation.Unsure)
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user