MCPcopy Create free account
hub / github.com/driangle/taskmd / TestFeedCommand_Limit

Function TestFeedCommand_Limit

apps/cli/internal/cli/feed_test.go:201–234  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

199}
200
201func TestFeedCommand_Limit(t *testing.T) {
202 resetFeedFlags()
203 feedLimit = 5
204
205 var capturedArgs []string
206 oldGitLog := gitLogFunc
207 gitLogFunc = func(_ string, args []string) (string, error) {
208 capturedArgs = args
209 return "", nil
210 }
211 defer func() { gitLogFunc = oldGitLog }()
212
213 oldGitShow := gitShowFunc
214 gitShowFunc = noopGitShow
215 defer func() { gitShowFunc = oldGitShow }()
216
217 _, err := captureFeedOutput(t, func() error {
218 return runFeed(feedCmd, nil)
219 })
220 if err != nil {
221 t.Fatalf("unexpected error: %v", err)
222 }
223
224 found := false
225 for _, arg := range capturedArgs {
226 if arg == "-5" {
227 found = true
228 break
229 }
230 }
231 if !found {
232 t.Errorf("expected -5 in git args, got: %v", capturedArgs)
233 }
234}
235
236func TestFeedCommand_Since(t *testing.T) {
237 resetFeedFlags()

Callers

nothing calls this directly

Calls 3

resetFeedFlagsFunction · 0.85
captureFeedOutputFunction · 0.85
runFeedFunction · 0.85

Tested by

no test coverage detected