improve test resiliency

This commit is contained in:
nate smith 2023-03-29 06:25:35 -07:00
parent 852bc00354
commit 1fb12a98ea

View file

@ -123,6 +123,7 @@ func TestListRun(t *testing.T) {
wantErr bool
wantOut string
wantErrOut string
wantErrMsg string
stubs func(*httpmock.Registry)
isTTY bool
}{
@ -343,7 +344,8 @@ func TestListRun(t *testing.T) {
httpmock.JSONResponse(shared.RunsPayload{}),
)
},
wantErr: true,
wantErr: true,
wantErrMsg: "no runs found",
},
{
name: "workflow selector",
@ -384,7 +386,8 @@ func TestListRun(t *testing.T) {
httpmock.JSONResponse(shared.RunsPayload{}),
)
},
wantErr: true,
wantErr: true,
wantErrMsg: "no runs found",
},
{
name: "actor filter applied",
@ -400,7 +403,8 @@ func TestListRun(t *testing.T) {
httpmock.JSONResponse(shared.RunsPayload{}),
)
},
wantErr: true,
wantErr: true,
wantErrMsg: "no runs found",
},
{
name: "status filter applied",
@ -417,7 +421,8 @@ func TestListRun(t *testing.T) {
httpmock.JSONResponse(shared.RunsPayload{}),
)
},
wantErr: true,
wantErr: true,
wantErrMsg: "no runs found",
},
}
@ -441,6 +446,7 @@ func TestListRun(t *testing.T) {
err := listRun(tt.opts)
if tt.wantErr {
assert.Error(t, err)
assert.Equal(t, tt.wantErrMsg, err.Error())
} else {
assert.NoError(t, err)
}