MCPcopy Create free account
hub / github.com/github/gh-aw / TestParseSlashCommandShorthand

Function TestParseSlashCommandShorthand

pkg/workflow/slash_command_parser_test.go:10–144  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

8)
9
10func TestParseSlashCommandShorthand(t *testing.T) {
11 tests := []struct {
12 name string
13 input string
14 expectedCommand string
15 expectedIsSlash bool
16 expectedError bool
17 errorSubstring string
18 }{
19 {
20 name: "valid simple command",
21 input: "/help",
22 expectedCommand: "help",
23 expectedIsSlash: true,
24 expectedError: false,
25 },
26 {
27 name: "valid command with hyphens",
28 input: "/my-bot",
29 expectedCommand: "my-bot",
30 expectedIsSlash: true,
31 expectedError: false,
32 },
33 {
34 name: "valid command with underscores",
35 input: "/code_review",
36 expectedCommand: "code_review",
37 expectedIsSlash: true,
38 expectedError: false,
39 },
40 {
41 name: "valid command with numbers",
42 input: "/bot123",
43 expectedCommand: "bot123",
44 expectedIsSlash: true,
45 expectedError: false,
46 },
47 {
48 name: "valid long command",
49 input: "/very-long-command-name-with-many-parts",
50 expectedCommand: "very-long-command-name-with-many-parts",
51 expectedIsSlash: true,
52 expectedError: false,
53 },
54 {
55 name: "empty command after slash",
56 input: "/",
57 expectedCommand: "",
58 expectedIsSlash: true,
59 expectedError: true,
60 errorSubstring: "slash command shorthand cannot be empty after '/'",
61 },
62 {
63 name: "not a slash command - regular event",
64 input: "push",
65 expectedCommand: "",
66 expectedIsSlash: false,
67 expectedError: false,

Callers

nothing calls this directly

Calls 4

RunMethod · 0.45
ErrorfMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected