MCPcopy Index your code
hub / github.com/docker/docker-agent / TestNewExecutor

Function TestNewExecutor

pkg/hooks/hooks_test.go:239–261  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

237}
238
239func TestNewExecutor(t *testing.T) {
240 t.Parallel()
241
242 config := &Config{
243 PreToolUse: []MatcherConfig{
244 {
245 Matcher: "shell|edit_file",
246 Hooks: []Hook{
247 {Type: HookTypeCommand, Command: "echo pre"},
248 },
249 },
250 },
251 }
252
253 exec := NewExecutor(config, "/tmp", []string{"FOO=bar"})
254 require.NotNil(t, exec)
255 assert.True(t, exec.Has(EventPreToolUse))
256 assert.False(t, exec.Has(EventPostToolUse))
257 assert.False(t, exec.Has(EventSessionStart))
258 assert.False(t, exec.Has(EventSessionEnd))
259 assert.False(t, exec.Has(EventStop))
260 assert.False(t, exec.Has(EventNotification))
261}
262
263func TestExecutorNilConfig(t *testing.T) {
264 t.Parallel()

Callers

nothing calls this directly

Calls 2

HasMethod · 0.95
NewExecutorFunction · 0.85

Tested by

no test coverage detected