(t *testing.T, chatID uuid.UUID, updateErr error)
| 319 | } |
| 320 | |
| 321 | func newTestRunnerWithChatArchive(t *testing.T, chatID uuid.UUID, updateErr error) (*Runner, func() bool) { |
| 322 | t.Helper() |
| 323 | |
| 324 | var archived atomic.Bool |
| 325 | client := newFakeChatClient(t) |
| 326 | client.updateChatFunc = func(ctx context.Context, gotChatID uuid.UUID, req codersdk.UpdateChatRequest) error { |
| 327 | if gotChatID != chatID { |
| 328 | return xerrors.Errorf("unexpected chat archive ID: %s", gotChatID) |
| 329 | } |
| 330 | if req.Archived == nil || !*req.Archived { |
| 331 | return xerrors.Errorf("unexpected archived value: %v", req.Archived) |
| 332 | } |
| 333 | archived.Store(true) |
| 334 | return updateErr |
| 335 | } |
| 336 | runner := &Runner{client: client, cfg: Config{}, chatID: chatID} |
| 337 | return runner, archived.Load |
| 338 | } |
| 339 | |
| 340 | func newTestRunnerWithChatMessage(t *testing.T, cfg Config, chatID uuid.UUID, onMessage func()) *Runner { |
| 341 | t.Helper() |
no test coverage detected