feat: operator schema accept command for curated FK review (P5)
This commit is contained in:
@@ -268,3 +268,38 @@ func TestParseVectorUnknownSubcommand(t *testing.T) {
|
||||
t.Fatal("expected error for unknown vector command")
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseSchemaAccept(t *testing.T) {
|
||||
req, err := Parse([]string{"schema", "accept", "--workspace", "psd", "--run", strings.Repeat("d", 32), "--yes"})
|
||||
if err != nil {
|
||||
t.Fatalf("parse: %v", err)
|
||||
}
|
||||
r, ok := req.(AcceptSchemaRequest)
|
||||
if !ok {
|
||||
t.Fatalf("got %T", req)
|
||||
}
|
||||
if r.Workspace != "psd" || r.Run != strings.Repeat("d", 32) || !r.Yes {
|
||||
t.Fatalf("unexpected request: %+v", r)
|
||||
}
|
||||
env, err := req.stdinEnvelope()
|
||||
if err != nil {
|
||||
t.Fatalf("envelope: %v", err)
|
||||
}
|
||||
if env.WorkspaceID != "psd" || env.RunID != strings.Repeat("d", 32) || !env.Yes {
|
||||
t.Fatalf("unexpected envelope: %+v", env)
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseSchemaAcceptRequiresRunAndYes(t *testing.T) {
|
||||
for _, args := range [][]string{
|
||||
{"schema", "accept", "--workspace", "psd"},
|
||||
{"schema", "accept", "--workspace", "psd", "--yes"},
|
||||
{"schema", "accept", "--workspace", "psd", "--run", strings.Repeat("d", 32)},
|
||||
{"schema", "accept", "--workspace", "psd", "--run", "not-hex", "--yes"},
|
||||
{"schema", "accept", "--workspace", "psd", "--run", strings.Repeat("d", 32), "--yes", "--run", strings.Repeat("e", 32)},
|
||||
} {
|
||||
if _, err := Parse(args); err == nil {
|
||||
t.Fatalf("expected error for %v", args)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user