Skip to content

Commit

Permalink
test: increase coverage
Browse files Browse the repository at this point in the history
Signed-off-by: starry-shivam <[email protected]>
  • Loading branch information
starry-shivam committed Sep 21, 2024
1 parent c99fbe4 commit cfd18ee
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/test/kotlin/dev/starry/ktscheduler/InMemoryJobStoreTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,24 @@ class InMemoryJobStoreTest {
assertTrue(allJobs.contains(job2))
}

@Test
fun `getDueJobs should not return jobs with nextRuntime null`() {
val job = Job(
jobId = "job1",
trigger = OneTimeTrigger(ZonedDateTime.now()),
nextRunTime = null,
dispatcher = Dispatchers.Default,
callback = { /* Do nothing */ }
)
jobStore.addJob(job)

val currentTime = ZonedDateTime.now()
val maxGraceTime = Duration.ofMinutes(1)

val dueJobsWithGraceTime = jobStore.getDueJobs(currentTime, maxGraceTime)
assertEquals(0, dueJobsWithGraceTime.size)
}

private fun createTestJob(jobId: String, nextRunTime: ZonedDateTime = ZonedDateTime.now()): Job {
return Job(
jobId = jobId,
Expand Down

0 comments on commit cfd18ee

Please sign in to comment.