Skip to content

Commit ff80571

Browse files
committed
fix: coderd: add test for nonexistent workspace
1 parent 270af35 commit ff80571

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

coderd/workspaces_test.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package coderd_test
22

33
import (
44
"context"
5+
"fmt"
56
"net/http"
67
"testing"
78
"time"
@@ -292,6 +293,21 @@ func TestWorkspaceUpdateAutostart(t *testing.T) {
292293
require.Equal(t, testCase.expectedInterval, interval, "unexpected interval")
293294
})
294295
}
296+
297+
t.Run("NotFound", func(t *testing.T) {
298+
var (
299+
ctx = context.Background()
300+
client = coderdtest.New(t, nil)
301+
_ = coderdtest.CreateFirstUser(t, client)
302+
wsid = uuid.New()
303+
req = codersdk.UpdateWorkspaceAutostartRequest{
304+
Schedule: "9 30 1-5",
305+
}
306+
)
307+
308+
err := client.UpdateWorkspaceAutostart(ctx, wsid, req)
309+
require.EqualError(t, err, fmt.Sprintf("status code 404: workspace %q does not exist", wsid), "unexpected error")
310+
})
295311
}
296312

297313
func mustLocation(t *testing.T, location string) *time.Location {

0 commit comments

Comments
 (0)