File tree 2 files changed +39
-1
lines changed
main/kotlin/it/krzeminski/githubactionstyping
test/kotlin/it/krzeminski/githubactionstyping/validation
2 files changed +39
-1
lines changed Original file line number Diff line number Diff line change 1
1
package it.krzeminski.githubactionstyping
2
2
3
3
import it.krzeminski.githubactionstyping.github.getBooleanInput
4
+ import it.krzeminski.githubactionstyping.parsing.TypesManifest
4
5
import it.krzeminski.githubactionstyping.parsing.parseManifest
5
6
import it.krzeminski.githubactionstyping.parsing.parseTypesManifest
6
7
import it.krzeminski.githubactionstyping.reporting.toPlaintextReport
7
8
import it.krzeminski.githubactionstyping.validation.ItemValidationResult
8
9
import it.krzeminski.githubactionstyping.validation.validate
9
10
10
11
fun manifestsToReport (manifest : String , typesManifest : String ): Pair <Boolean , String > {
11
- val parsedTypesManifest = parseTypesManifest(typesManifest)
12
+ val parsedTypesManifest = if (typesManifest.isNotBlank()) {
13
+ parseTypesManifest(typesManifest)
14
+ } else {
15
+ TypesManifest ()
16
+ }
12
17
val parsedManifest = parseManifest(manifest)
13
18
14
19
val inputsInTypesManifest = parsedTypesManifest.inputs.keys
Original file line number Diff line number Diff line change @@ -120,6 +120,39 @@ class ManifestsToReportTest : FunSpec({
120
120
}
121
121
}
122
122
123
+ test("blank types YAML ") {
124
+ // when
125
+ val manifest = """
126
+ name: GitHub Actions Typing
127
+ description: Bring type-safety to your GitHub actions' API!
128
+ author: Piotr Krzemiński
129
+ runs:
130
+ using: 'docker'
131
+ image: 'Dockerfile'
132
+ """ .trimIndent()
133
+ val typesManifest = " "
134
+
135
+ // when
136
+ val (isValid, report) = manifestsToReport(manifest, typesManifest)
137
+
138
+ // then
139
+ assertSoftly {
140
+ isValid shouldBe true
141
+ report shouldBe """
142
+ Overall result:
143
+ ${' \u001b ' } [32m✔ VALID${' \u001b ' } [0m
144
+
145
+ Inputs:
146
+ None.
147
+
148
+ Outputs:
149
+ None.
150
+
151
+
152
+ """ .trimIndent()
153
+ }
154
+ }
155
+
123
156
test("enum: missing allowed values") {
124
157
// when
125
158
val manifest = """
You can’t perform that action at this time.
0 commit comments