Skip to content

Commit

Permalink
Add fuel test runner
Browse files Browse the repository at this point in the history
  • Loading branch information
pawelpasterz committed Jan 29, 2021
1 parent d0bc98b commit a9b3eda
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/Versions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ object Versions {
// https://github.com/getsentry/sentry-java/releases
const val SENTRY = "3.2.1"

//https://github.com/mixpanel/mixpanel-java/releases
// https://github.com/mixpanel/mixpanel-java/releases
const val MIXPANEL = "1.5.0"

// https://github.com/3breadt/dd-plist/releases
Expand Down
2 changes: 1 addition & 1 deletion flank-scripts/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ shadowJar.apply {
}
}
// <breaking change>.<feature added>.<fix/minor change>
version = "1.4.5"
version = "1.4.6"
group = "com.github.flank"

application {
Expand Down
19 changes: 13 additions & 6 deletions flank-scripts/src/test/kotlin/flank/common/FilesTest.kt
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
package flank.common

import flank.scripts.FuelTestRunner
import org.junit.Assert
import org.junit.Assume
import org.junit.Rule
import org.junit.Test
import java.io.File
import org.junit.rules.TemporaryFolder
import org.junit.runner.RunWith
import java.nio.file.Files
import java.nio.file.Paths

@RunWith(FuelTestRunner::class)
internal class FilesTest {

@get:Rule
val root = TemporaryFolder()

@Test
fun `Should create symbolic file at desired location`() {
Assume.assumeFalse(isWindows)
// given
val testFile = File.createTempFile("test", "file").toPath()
val expectedDestination = Paths.get(Files.createTempDirectory("temp").toString(), "test.link")
val testFile = root.newFile("test.file").toPath()
val expectedDestination = Paths.get(root.newFolder("temp").toString(), "test.link")

// when
createSymbolicLinkToFile(expectedDestination, testFile)
Expand All @@ -30,8 +37,8 @@ internal class FilesTest {
@Test
fun `Should download file and store it and destination`() {
// given
val testSource = "https://github.com/Flank/flank/blob/master/settings.gradle.kts"
val testDestination = Paths.get(Files.createTempDirectory("temp").toString(), "settings.gradle.kts")
val testSource = "https://path.com/to/test/settings.gradle.kts"
val testDestination = Paths.get(root.newFolder("temp").toString(), "settings.gradle.kts")

// when
downloadFile(testSource, testDestination)
Expand All @@ -44,7 +51,7 @@ internal class FilesTest {
@Test
fun `Should check if directory contains all needed files`() {
// given
val testDirectory = Files.createTempDirectory("test")
val testDirectory = root.newFolder("test").toPath()
val testFiles = listOf(
Paths.get(testDirectory.toString(), "testFile1"),
Paths.get(testDirectory.toString(), "testFile2"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class FuelMockServer : Client {
return when {
url.startsWith("https://api.github.com/repos/flank/flank/", ignoreCase = true) -> handleGithubMockRequest(url, request)
url.startsWith(ZENHUB_BASE_URL) -> handleZenhubMockRequest(url, request)
url == "https://path.com/to/test/settings.gradle.kts" -> request.buildResponse("not empty", 200)
else -> Response(request.url)
}
}
Expand Down

0 comments on commit a9b3eda

Please sign in to comment.