MCPcopy
hub / github.com/jetify-com/devbox / TestTaskLastRun

Function TestTaskLastRun

internal/setup/setup_test.go:70–98  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

68}
69
70func TestTaskLastRun(t *testing.T) {
71 tempXDGStateDir(t)
72
73 task := &testTask{
74 RunFunc: func(ctx context.Context) error { return nil },
75 NeedsRunFunc: func(context.Context, RunInfo) bool { return true },
76 }
77 err := Run(t.Context(), t.Name(), task)
78 if err != nil {
79 t.Error("got non-nil error on first run:", err)
80 }
81
82 task.NeedsRunFunc = func(ctx context.Context, lastRun RunInfo) bool {
83 if lastRun.Time.IsZero() {
84 t.Error("got zero lastRun.Time on second run")
85 }
86 if lastRun.Version == "" {
87 t.Error("got empty lastRun.Version on second run")
88 }
89 if lastRun.Error != "" {
90 t.Errorf("got non-empty lastRun.Error on second run: %v", lastRun.Error)
91 }
92 return false
93 }
94 err = Run(t.Context(), t.Name(), task)
95 if err != nil {
96 t.Error("got non-nil error on second run:", err)
97 }
98}
99
100func TestTaskConfirmPromptAllow(t *testing.T) {
101 tempXDGStateDir(t)

Callers

nothing calls this directly

Calls 3

tempXDGStateDirFunction · 0.85
RunFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected