Publish Claude Code Binaries / Stage and publish binaries (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-arm64 (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build linux-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build windows-amd64 (push) Canceled after 0s
Sync Tutti Agent Skills / sync (push) Canceled after 0s
Windows Agent Adapters / Test Windows agent adapters (push) Canceled after 0s
Windows Daemon Adapters / Test Windows daemon adapters (push) Canceled after 0s
Publish Tutti App Runtime / Publish runtime catalog (push) Canceled after 0s
45 lines
1.2 KiB
Go
45 lines
1.2 KiB
Go
package eventstream
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestDesktopPreferencesValidatorsRejectInvalidSessionLaunchModes(t *testing.T) {
|
|
tests := []struct {
|
|
name string
|
|
payload string
|
|
}{
|
|
{
|
|
name: "unsupported mode",
|
|
payload: `{"preferences":{"agentSessionLaunchModesByWorkspace":{"workspace-1":{"project:alpha":"remote"}}}}`,
|
|
},
|
|
{
|
|
name: "empty workspace id",
|
|
payload: `{"preferences":{"agentSessionLaunchModesByWorkspace":{"":{"project:alpha":"worktree"}}}}`,
|
|
},
|
|
{
|
|
name: "empty project section key",
|
|
payload: `{"preferences":{"agentSessionLaunchModesByWorkspace":{"workspace-1":{"":"worktree"}}}}`,
|
|
},
|
|
}
|
|
validators := []struct {
|
|
name string
|
|
validate func([]byte) error
|
|
}{
|
|
{name: "client intent", validate: validateDesktopPreferencesUpdateRequestedPayload},
|
|
{name: "server event", validate: validateDesktopPreferencesUpdatedPayload},
|
|
}
|
|
|
|
for _, validator := range validators {
|
|
for _, test := range tests {
|
|
t.Run(validator.name+"/"+test.name, func(t *testing.T) {
|
|
err := validator.validate([]byte(test.payload))
|
|
if err == nil || !strings.Contains(err.Error(), "agentSessionLaunchModesByWorkspace") {
|
|
t.Fatalf("validation error = %v, want launch-mode rejection", err)
|
|
}
|
|
})
|
|
}
|
|
}
|
|
}
|