Last active
November 22, 2024 08:31
-
-
Save krzema12/415ce3682261a8aff5fba112398d8119 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CheckoutV2Test : DescribeSpec({ | |
it("renders with defaults") { | |
// given | |
val action = CheckoutV2() | |
// when | |
val yaml = action.toYamlArguments() | |
// then | |
yaml shouldBe linkedMapOf() | |
} | |
it("renders with all parameters") { | |
// given | |
val action = CheckoutV2( | |
repository = "repository1", | |
ref = "ref1", | |
token = "token1", | |
sshKey = "ssh-key1", | |
sshKnownHosts = "ssh-known-hosts1", | |
sshStrict = true, | |
persistCredentials = false, | |
path = "path1", | |
clean = true, | |
fetchDepth = FetchDepth.Quantity(1), | |
lfs = false, | |
submodules = true, | |
) | |
// when | |
val yaml = action.toYamlArguments() | |
// then | |
yaml shouldBe linkedMapOf( | |
"repository" to "repository1", | |
"ref" to "ref1", | |
"token" to "token1", | |
"ssh-key" to "ssh-key1", | |
"ssh-known-hosts" to "ssh-known-hosts1", | |
"ssh-strict" to "true", | |
"persist-credentials" to "false", | |
"path" to "path1", | |
"clean" to "true", | |
"fetch-depth" to "1", | |
"lfs" to "false", | |
"submodules" to "true", | |
) | |
} | |
it("renders fetch depth with specified infinite fetch depth") { | |
// given | |
val action = CheckoutV2( | |
fetchDepth = FetchDepth.Infinite, | |
) | |
// when | |
val yaml = action.toYamlArguments() | |
// then | |
yaml shouldBe linkedMapOf( | |
"fetch-depth" to "0", | |
) | |
} | |
}) | |
// https://github.com/typesafegithub/github-workflows-kt/blob/fff718c1737974a8d5d8ebc5b6ee8d2bcfd76d36/library/src/test/kotlin/it/krzeminski/githubactions/actions/actions/CheckoutV2Test.kt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment