Skip to content

Commit

Permalink
Improve getCommitDate test
Browse files Browse the repository at this point in the history
  • Loading branch information
fthomas committed Jan 21, 2025
1 parent 7c1dc3c commit 462f3e0
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import org.scalasteward.core.io.ProcessAlgTest.ioProcessAlg
import org.scalasteward.core.io.{FileAlg, ProcessAlg, WorkspaceAlg}
import org.scalasteward.core.mock.MockConfig.{config, mockRoot}
import org.scalasteward.core.util.Nel
import scala.concurrent.duration.DurationInt

class FileGitAlgTest extends CatsEffectSuite {
private val rootDir = mockRoot / "git-tests"
Expand Down Expand Up @@ -165,8 +166,9 @@ class FileGitAlgTest extends CatsEffectSuite {
sha1 <- ioGitAlg.latestSha1(repo, master)
commitDate <- ioGitAlg.getCommitDate(repo, sha1)
now <- ioDateTimeAlg.currentTimestamp
diff = commitDate.until(now).toMinutes.abs
_ = assert(diff < 7200L, clue((commitDate, now)))
diff = commitDate.until(now)
maxDrift = 2.hours
_ = assert(diff > -maxDrift && diff < maxDrift, clue((commitDate, now)))
} yield ()
}

Expand Down

0 comments on commit 462f3e0

Please sign in to comment.