| 1 | package workbench |
| 2 | |
| 3 | import "testing" |
| 4 | |
| 5 | func TestAdoptedMobileTurns(t *testing.T) { |
| 6 | legacy := []mobileTurn{{ID: "failed", Prompt: "failed first", Status: "failed", Error: "not started"}, |
| 7 | {ID: "mobile", Prompt: "hello", Text: "old partial", Status: "completed"}} |
| 8 | current := []mobileTurn{{ID: "cli", Prompt: "hello", Text: "complete", Status: "completed"}, |
| 9 | {ID: "new", Prompt: "next", Status: "running"}} |
| 10 | got := adoptedMobileTurns(legacy, current) |
| 11 | if len(got) != 3 || got[0].ID != "failed" || got[1].ID != "mobile" || got[1].Text != "complete" || got[2].ID != "new" { |
| 12 | t.Fatalf("history or request identity lost: %#v", got) |
| 13 | } |
| 14 | |
| 15 | if got := adoptedMobileTurns(legacy, nil); len(got) != 2 || got[1].Text != "old partial" { |
| 16 | t.Fatal(got) |
| 17 | } |
| 18 | } |