Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix: Fix flank-scripts test #1177

Merged
merged 1 commit into from
Oct 1, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,17 @@ import flank.scripts.FuelTestRunner
import flank.scripts.ci.releasenotes.GitHubRelease
import flank.scripts.github.getLatestReleaseTag
import io.mockk.coEvery
import io.mockk.every
import io.mockk.mockkStatic
import io.mockk.unmockkAll
import org.junit.After
import org.junit.Rule
import org.junit.Test
import org.junit.contrib.java.lang.system.ExpectedSystemExit
import org.junit.contrib.java.lang.system.SystemOutRule
import org.junit.runner.RunWith
import java.time.LocalDate
import java.time.Year

@RunWith(FuelTestRunner::class)
class NextReleaseTagCommandTest {
Expand All @@ -24,9 +29,18 @@ class NextReleaseTagCommandTest {
@JvmField
val systemExit = ExpectedSystemExit.none()!!

@After
fun tearDown() = unmockkAll()

@Test
fun `Should return properly message when success`() {
mockkStatic("flank.scripts.github.GithubApiKt") {
mockkStatic(
"flank.scripts.github.GithubApiKt",
"java.time.LocalDate",
"java.time.Year"
) {
every { LocalDate.now() } returns LocalDate.of(2020, 9, 16)
every { Year.now() } returns Year.of(2020)
coEvery { getLatestReleaseTag(any()) } returns Result.success(GitHubRelease("v20.09.0"))

// when
Expand Down