Download this file
| 1 | package codex |
| 2 | |
| 3 | import ( |
| 4 | "amadan.net/oficina/equipo/internal/runner/provider" |
| 5 | "context" |
| 6 | "testing" |
| 7 | ) |
| 8 | |
| 9 | func TestCodexResumeUsageSnapshot(t *testing.T) { |
| 10 | for _, mode := range []string{"resume-usage", "resume-usage-changed"} { |
| 11 | t.Run(mode, func(t *testing.T) { |
| 12 | f := fixtureFor(t) |
| 13 | s, events := openFixture(t, f) |
| 14 | if err := f.l.StartTurn(context.Background(), s, provider.Turn{ID: "first", AdmissionID: "first", Prompt: "ready"}); err != nil { |
| 15 | t.Fatal(err) |
| 16 | } |
| 17 | terminal(t, events) |
| 18 | f.host.set(mode) |
| 19 | err := f.l.StartTurn(context.Background(), s, provider.Turn{ID: "second", AdmissionID: "second", Prompt: "ready"}) |
| 20 | if mode == "resume-usage-changed" { |
| 21 | if err == nil && terminal(t, events).Kind != "turn.failed" { |
| 22 | t.Fatal("changed snapshot accepted") |
| 23 | } |
| 24 | return |
| 25 | } |
| 26 | if err != nil { |
| 27 | t.Fatal(err) |
| 28 | } |
| 29 | if ev := terminal(t, events); ev.Kind != "turn.completed" { |
| 30 | t.Fatal(ev) |
| 31 | } |
| 32 | }) |
| 33 | } |
| 34 | } |
| 35 | |