newTestAPIWithOptions creates a new API with optional updateEnv and workingDir hooks.
(t *testing.T, updateEnv func([]string) ([]string, error), workingDir func() string)
| 131 | // newTestAPIWithOptions creates a new API with optional |
| 132 | // updateEnv and workingDir hooks. |
| 133 | func newTestAPIWithOptions(t *testing.T, updateEnv func([]string) ([]string, error), workingDir func() string) http.Handler { |
| 134 | t.Helper() |
| 135 | |
| 136 | logger := slogtest.Make(t, &slogtest.Options{ |
| 137 | IgnoreErrors: true, |
| 138 | }).Leveled(slog.LevelDebug) |
| 139 | api := agentproc.NewAPI(logger, agentexec.DefaultExecer, updateEnv, nil, workingDir) |
| 140 | t.Cleanup(func() { |
| 141 | _ = api.Close() |
| 142 | }) |
| 143 | return agentchat.Middleware(api.Routes()) |
| 144 | } |
| 145 | |
| 146 | func TestAccessLogIncludesChatID(t *testing.T) { |
| 147 | t.Parallel() |
no test coverage detected