-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
recursively look for parent files of changed API specifications
- Loading branch information
1 parent
e03c262
commit 13805eb
Showing
2 changed files
with
67 additions
and
15 deletions.
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
39 changes: 39 additions & 0 deletions
39
application/src/test/kotlin/application/BackwardCompatibilityCheckCommandTest.kt
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,39 @@ | ||
package application | ||
|
||
import io.mockk.every | ||
import io.mockk.mockk | ||
import org.junit.jupiter.api.Assertions.* | ||
import org.junit.jupiter.api.Test | ||
import java.io.File | ||
|
||
class BackwardCompatibilityCheckCommandTest { | ||
|
||
@Test | ||
fun `filesReferringToChangedSchemaFiles returns empty set when input is empty`() { | ||
val command = BackwardCompatibilityCheckCommand(mockk()) | ||
val result = command.filesReferringToChangedSchemaFiles(emptySet()) | ||
assertTrue(result.isEmpty()) | ||
} | ||
|
||
@Test | ||
fun `filesReferringToChangedSchemaFiles returns empty set when no files refer to changed schema files`() { | ||
val command = BackwardCompatibilityCheckCommand(mockk(relaxed = true)) | ||
every { command.allOpenApiSpecFiles() } returns listOf( | ||
File("file1.yaml").apply { writeText("content1") }, | ||
File("file2.yaml").apply { writeText("content2") } | ||
) | ||
val result = command.filesReferringToChangedSchemaFiles(setOf("file3.yaml")) | ||
assertTrue(result.isEmpty()) | ||
} | ||
|
||
@Test | ||
fun `filesReferringToChangedSchemaFiles returns set of files that refer to changed schema files`() { | ||
val command = mockk<BackwardCompatibilityCheckCommand>(relaxed = true) | ||
every { command.allOpenApiSpecFiles() } returns listOf( | ||
File("file1.yaml").apply { writeText("file3.yaml") }, | ||
File("file2.yaml").apply { writeText("file4.yaml") } | ||
) | ||
val result = command.filesReferringToChangedSchemaFiles(setOf("file3.yaml")) | ||
assertEquals(setOf("file1.yaml"), result) | ||
} | ||
} |