| 151 | } |
| 152 | |
| 153 | func TestContextAdapter_Validation(t *testing.T) { |
| 154 | cli, corpus := newContextTestCLI(t) |
| 155 | a := &contextPluginAdapter{cli: cli} |
| 156 | |
| 157 | if _, err := a.Create("bad", "bogus-mode", []string{corpus}, "", false); err == nil { |
| 158 | t.Error("invalid mode must error") |
| 159 | } |
| 160 | if _, err := a.Attach("nonexistent", 0, 0); err == nil { |
| 161 | t.Error("attaching a missing context must error") |
| 162 | } |
| 163 | if _, err := a.Detach("nonexistent"); err == nil { |
| 164 | t.Error("detaching a missing context must error") |
| 165 | } |
| 166 | if _, err := a.Delete("nonexistent"); err == nil { |
| 167 | t.Error("deleting a missing context must error") |
| 168 | } |
| 169 | } |
| 170 | |
| 171 | func TestContextAdapter_WithoutManager(t *testing.T) { |
| 172 | a := &contextPluginAdapter{cli: &ChatCLI{}} |