Skip to content

Commit

Permalink
Fix test scenarios
Browse files Browse the repository at this point in the history
  • Loading branch information
pierrehilbert committed Sep 19, 2023
1 parent db660f2 commit fe85b0d
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -53,22 +53,27 @@ func TestVerifier(t *testing.T) {
verifiers: []CheckableVerifier{&ErrorVerifier{}, &SuccVerifier{}, &FailVerifier{}},
checkFunc: func(d []CheckableVerifier) bool { return d[0].Called() && d[1].Called() && !d[2].Called() },
expectedResult: true,
expectedErrors: true,
}, {
verifiers: []CheckableVerifier{&SuccVerifier{}, &ErrorVerifier{}, &FailVerifier{}},
checkFunc: func(d []CheckableVerifier) bool { return d[0].Called() && !d[1].Called() && !d[2].Called() },
expectedResult: true,
expectedErrors: false,
}, {
verifiers: []CheckableVerifier{&FailVerifier{}, &ErrorVerifier{}, &SuccVerifier{}},
checkFunc: func(d []CheckableVerifier) bool { return d[0].Called() && d[1].Called() && d[2].Called() },
expectedResult: true,
expectedErrors: true,
}, {
verifiers: []CheckableVerifier{&ErrorVerifier{}, &FailVerifier{}, &SuccVerifier{}},
checkFunc: func(d []CheckableVerifier) bool { return d[0].Called() && d[1].Called() && d[2].Called() },
expectedResult: true,
expectedErrors: true,
}, {
verifiers: []CheckableVerifier{&ErrorVerifier{}, &ErrorVerifier{}, &FailVerifier{}},
checkFunc: func(d []CheckableVerifier) bool { return d[0].Called() && d[1].Called() && d[2].Called() },
expectedResult: false,
expectedErrors: true,
},
}

Expand All @@ -77,7 +82,7 @@ func TestVerifier(t *testing.T) {
success, err := d.Verify(artifact.Artifact{Name: "a", Cmd: "a", Artifact: "a/a"}, "b", false)

assert.Equal(t, tc.expectedResult, success == true)
assert.Equal(t, tc.expectedResult, err == nil)
assert.Equal(t, tc.expectedErrors, err != nil)

assert.True(t, tc.checkFunc(tc.verifiers))
}
Expand All @@ -92,4 +97,5 @@ type verifyTestCase struct {
verifiers []CheckableVerifier
checkFunc func(verifiers []CheckableVerifier) bool
expectedResult bool
expectedErrors bool
}

0 comments on commit fe85b0d

Please sign in to comment.