feat: add --prune and a rolled-back --dry-run to bm:seed

This commit is contained in:
Jakub Zych
2026-10-02 17:28:07 +02:00
parent e8411adac3
commit 28f68d002f
6 changed files with 192 additions and 23 deletions

View File

@@ -55,12 +55,11 @@ func TestSeedCommandChecksTheFileBeforeTheDatabase(t *testing.T) {
}
out.Reset()
if err := bonfire.Call(context.Background(), cmds, "bm:seed", []string{"../testdata/seed.example.json", "--dry-run"}, &out); err != nil {
t.Fatalf("dry run: %v", err)
}
if called || !strings.Contains(out.String(), "3 courses") {
t.Errorf("dry run called=%v output %q", called, out.String())
err = bonfire.Call(context.Background(), cmds, "bm:seed", []string{"../testdata/seed.example.json", "--dry-run", "--prune"}, &out)
if !called || err == nil || !strings.Contains(out.String(), "3 courses") {
t.Errorf("dry run called=%v err=%v output %q, want the validation line and the withDB error", called, err, out.String())
}
called = false
err = bonfire.Call(context.Background(), cmds, "bm:seed", []string{"../testdata/seed.example.json"}, &out)
if !called || err == nil {