8000 test: add test cases for multiple manifests by krzema12 · Pull Request #258 · typesafegithub/github-actions-typing · GitHub
[go: up one dir, main page]

Skip to content

test: add test cases for multiple manifests #258

New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
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
82 changes: 82 additions & 0 deletions src/jvmTest/kotlin/it/krzeminski/githubactionstyping/LogicTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,88 @@ class LogicTest : FunSpec({
}
}

test("repo with top-level action with valid typings, and nested action and all valid typings") {
// When
val (isValid, report) = validateTypings(
repoRoot = testRepos.resolve("repo-with-top-level-and-nested-action-and-valid-typings"),
)

// Then
assertSoftly {
isValid shouldBe true
report shouldBe """
For action with manifest at 'action.yml':
Result:
${'\u001b'}[32m✔ VALID${'\u001b'}[0m

Inputs:
• verbose:
${'\u001b'}[32m✔ VALID${'\u001b'}[0m
• someEnum:
${'\u001b'}[32m✔ VALID${'\u001b'}[0m

Outputs:
None.


""".trimIndent()
}
}

test("repo with top-level action with valid typings, and nested action with invalid typings") {
// When
val (isValid, report) = validateTypings(
repoRoot = testRepos.resolve("repo-with-top-level-and-nested-action-and-invalid-typings"),
)

// Then
assertSoftly {
isValid shouldBe true
report shouldBe """
For action with manifest at 'action.yml':
Result:
${'\u001b'}[32m✔ VALID${'\u001b'}[0m

Inputs:
• verbose:
${'\u001b'}[32m✔ VALID${'\u001b'}[0m
• someEnum:
${'\u001b'}[32m✔ VALID${'\u001b'}[0m

Outputs:
None.


""".trimIndent()
}
}

test("repo with no top-level action, but with nested action with valid typings") {
// When
val (isValid, report) = validateTypings(
repoRoot = testRepos.resolve("repo-with-no-top-level-and-just-nested-action-with-valid-typings"),
)

// Then
assertSoftly {
isValid shouldBe false
report shouldBe "No action manifest (action.yml or action.yaml) found!"
}
}

test("repo with no top-level action, but with nested action with invalid typings") {
// When
val (isValid, report) = validateTypings(
repoRoot = testRepos.resolve("repo-with-no-top-level-and-just-nested-action-with-invalid-typings"),
)

// Then
assertSoftly {
isValid shouldBe false
report shouldBe "No action manifest (action.yml or action.yaml) found!"
}
}

test("repo with only top-level action and no top-level manifest") {
// When
val (isValid, report) = validateTypings(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
I'm an action without a top-level "action.yml", but with an action that lives inside a directory and has valid typings.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
inputs:
verbose:
type: boolean
someInt:
type: integer
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: GitHub Actions Typing
description: Bring type-safety to your GitHub actions' API!
author: Piotr Krzemiński
inputs:
verbose:
description: 'Set to true to display debug information helpful when troubleshooting issues with this action.'
required: false
default: 'false'
someEnum:
description: 'Testing enum'
required: false
runs:
using: 'docker'
image: 'Dockerfile'
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
I'm an action without a top-level "action.yml", but with an action that lives inside a directory and has valid typings.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
inputs:
verbose:
type: boolean
someEnum:
type: enum
allowed-values:
- foo
- bar
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: GitHub Actions Typing
description: Bring type-safety to your GitHub actions' API!
author: Piotr Krzemiński
inputs:
verbose:
description: 'Set to true to display debug information helpful when troubleshooting issues with this action.'
required: false
default: 'false'
someEnum:
description: 'Testing enum'
required: false
runs:
using: 'docker'
image: 'Dockerfile'
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
I'm an action with a top-level "action.yml" and its associated typings that are valid, and also with an action that
lives inside a directory and has invalid typings.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
inputs:
verbose:
type: boolean
someEnum:
type: enum
allowed-values:
- foo
- bar
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: GitHub Actions Typing
description: Bring type-safety to your GitHub actions' API!
author: Piotr Krzemiński
inputs:
verbose:
description: 'Set to true to display debug information helpful when troubleshooting issues with this action.'
required: false
default: 'false'
someEnum:
description: 'Testing enum'
required: false
runs:
using: 'docker'
image: 'Dockerfile'
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
inputs:
verbose:
type: boolean
someInt:
type: integer
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: GitHub Actions Typing
description: Bring type-safety to your GitHub actions' API!
author: Piotr Krzemiński
inputs:
verbose:
description: 'Set to true to display debug information helpful when troubleshooting issues with this action.'
required: false
default: 'false'
someEnum:
description: 'Testing enum'
required: false
runs:
using: 'docker'
image: 'Dockerfile'
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
I'm an action with a top-level "action.yml" and its associated typings that are valid, and also with an action that
lives inside a directory and has valid typings.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
inputs:
verbose:
type: boolean
someEnum:
type: enum
allowed-values:
- foo
- bar
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: GitHub Actions Typing
description: Bring type-safety to your GitHub actions' API!
author: Piotr Krzemiński
inputs:
verbose:
description: 'Set to true to display debug information helpful when troubleshooting issues with this action.'
required: false
default: 'false'
someEnum:
description: 'Testing enum'
required: false
runs:
using: 'docker'
image: 'Dockerfile'
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
inputs:
verbose:
type: boolean
someEnum:
type: enum
allowed-values:
- foo
- bar
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: GitHub Actions Typing
description: Bring type-safety to your GitHub actions' API!
author: Piotr Krzemiński
inputs:
verbose:
description: 'Set to true to display debug information helpful when troubleshooting issues with this action.'
required: false
default: 'false'
someEnum:
description: 'Testing enum'
required: false
runs:
using: 'docker'
image: 'Dockerfile'
Loading
0