Skip to content

Commit

Permalink
Add extra test
Browse files Browse the repository at this point in the history
  • Loading branch information
vardius committed Feb 16, 2023
1 parent 31dc340 commit 8de3a12
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions gollback_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,19 @@ func TestRace(t *testing.T) {
wantErr bool
}{
{name: "no callback", want: nil, wantErr: true, fns: []AsyncFunc{}},
{name: "does not return error", want: 1, wantErr: false, fns: []AsyncFunc{
func(ctx context.Context) (interface{}, error) {
time.Sleep(time.Second)
return 1, nil
},
func(ctx context.Context) (interface{}, error) {
time.Sleep(time.Second)
return 1, nil
},
func(ctx context.Context) (interface{}, error) {
return nil, errors.New("failed")
},
}},
{name: "first non error wins", want: 3, wantErr: false, fns: []AsyncFunc{
func(ctx context.Context) (interface{}, error) {
time.Sleep(3 * time.Second)
Expand Down

0 comments on commit 8de3a12

Please sign in to comment.