Created
April 10, 2022 18:08
-
-
Save hexfusion/f2053003fc6fa142b2c3a5e7e0da473c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func Test_NewAggregate(t *testing.T) { | |
assert := assert.New(t) | |
scenarios := []struct { | |
name string | |
errs []error | |
wantNil bool | |
}{ | |
{ | |
name: "no errors", | |
errs: nil, | |
wantNil: true, | |
}, | |
{ | |
name: "concat errors", | |
errs: []error{errors.New("foo"), errors.New("bar")}, | |
}, | |
} | |
for _, scenario := range scenarios { | |
t.Run(scenario.name, func(t *testing.T) { | |
err := NewAggregate(scenario.errs) | |
if scenario.wantNil { | |
assert.Nil(err) | |
return | |
} | |
assert.NotNil(err) | |
}) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment