(t *testing.T)
| 8 | ) |
| 9 | |
| 10 | func 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, |
nothing calls this directly
no test coverage detected