Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

Commit

Permalink
Fixed unit tests
Browse files Browse the repository at this point in the history
Signed-off-by: pmahindrakar-oss <[email protected]>
  • Loading branch information
pmahindrakar-oss committed Sep 26, 2022
1 parent f9c2772 commit 305978d
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions scheduler/core/gocron_scheduler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,20 +129,14 @@ func setupWithSchedules(t *testing.T, subscope string, schedules []models.Schedu
func TestCalculateSnapshot(t *testing.T) {
t.Run("empty snapshot", func(t *testing.T) {
ctx := context.Background()
g := setup(t, "empty_snapshot")
g := setupWithSchedules(t, "empty_snapshot", nil)
snapshot := g.CalculateSnapshot(ctx)
assert.NotNil(t, snapshot)
assert.True(t, snapshot.IsEmpty())
})
t.Run("non empty snapshot", func(t *testing.T) {
ctx := context.Background()
g := setup(t, "non_empty_snapshot")
g.jobStore.Range(func(key, value interface{}) bool {
currTime := time.Now()
job := value.(*GoCronJob)
job.lastTime = &currTime
return true
})
snapshot := g.CalculateSnapshot(ctx)
assert.NotNil(t, snapshot)
assert.False(t, snapshot.IsEmpty())
Expand Down

0 comments on commit 305978d

Please sign in to comment.