(t *testing.T)
| 69 | } |
| 70 | |
| 71 | func TestHandleHook_LogsCommand(t *testing.T) { |
| 72 | tests := []struct { |
| 73 | rootCmd string |
| 74 | wantHint func(appID string) string |
| 75 | }{ |
| 76 | {rootCmd: "compose logs", wantHint: composeLogsHint}, |
| 77 | {rootCmd: "logs", wantHint: dockerLogsHint}, |
| 78 | } |
| 79 | for _, tt := range tests { |
| 80 | t.Run(tt.rootCmd, func(t *testing.T) { |
| 81 | data := marshalHookData(t, hooks.Request{ |
| 82 | RootCmd: tt.rootCmd, |
| 83 | }) |
| 84 | var buf bytes.Buffer |
| 85 | err := handleHook(t.Context(), []string{data}, &buf) |
| 86 | assert.NilError(t, err) |
| 87 | |
| 88 | msg := unmarshalResponse(t, buf.Bytes()) |
| 89 | assert.Equal(t, msg.Type, hooks.NextSteps) |
| 90 | assert.Equal(t, msg.Template, tt.wantHint("")) |
| 91 | }) |
| 92 | } |
| 93 | } |
| 94 | |
| 95 | func TestHandleHook_ComposeUpDetached(t *testing.T) { |
| 96 | tests := []struct { |
nothing calls this directly
no test coverage detected