-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Jendrik Johannes <[email protected]>
- Loading branch information
Showing
3 changed files
with
43 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
package org.hiero.gradle.test | ||
|
||
import org.assertj.core.api.Assertions.assertThat | ||
import org.gradle.testkit.runner.TaskOutcome | ||
import org.hiero.gradle.test.fixtures.GradleProject | ||
import org.junit.jupiter.api.Test | ||
|
||
class QualityGateTest { | ||
|
||
@Test | ||
fun `qualityGate formats yml and yaml files`() { | ||
val p = GradleProject().withMinimalStructure() | ||
val flow1 = p.file(".github/workflows/flow1.yml", "name: Flow 1 ") | ||
val flow2 = p.file(".github/workflows/flow2.yaml", "name: Flow 2 ") | ||
val txtFile = p.file(".github/workflows/temp.txt", "name: Flow 3 ") | ||
|
||
val result = p.qualityGate() | ||
|
||
assertThat(flow1) | ||
.hasContent( | ||
""" | ||
# SPDX-License-Identifier: Apache-2.0 | ||
name: Flow 1 | ||
""" | ||
.trimIndent() | ||
) | ||
assertThat(flow2) | ||
.hasContent( | ||
""" | ||
# SPDX-License-Identifier: Apache-2.0 | ||
name: Flow 2 | ||
""" | ||
.trimIndent() | ||
) | ||
assertThat(txtFile).hasContent("name: Flow 3 ") // unchanged | ||
|
||
assertThat(result.task(":qualityGate")?.outcome).isEqualTo(TaskOutcome.SUCCESS) | ||
} | ||
} |
This file contains 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