MCPcopy
hub / github.com/pocketbase/pocketbase / TestCronRemoveAll

Function TestCronRemoveAll

tools/cron/cron_test.go:163–189  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

161}
162
163func TestCronRemoveAll(t *testing.T) {
164 t.Parallel()
165
166 c := New()
167
168 if err := c.Add("test1", "* * * * *", func() {}); err != nil {
169 t.Fatal(err)
170 }
171
172 if err := c.Add("test2", "* * * * *", func() {}); err != nil {
173 t.Fatal(err)
174 }
175
176 if err := c.Add("test3", "* * * * *", func() {}); err != nil {
177 t.Fatal(err)
178 }
179
180 if v := len(c.jobs); v != 3 {
181 t.Fatalf("Expected %d jobs, got %d", 3, v)
182 }
183
184 c.RemoveAll()
185
186 if v := len(c.jobs); v != 0 {
187 t.Fatalf("Expected %d jobs, got %d", 0, v)
188 }
189}
190
191func TestCronTotal(t *testing.T) {
192 t.Parallel()

Callers

nothing calls this directly

Calls 3

NewFunction · 0.70
AddMethod · 0.45
RemoveAllMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…