-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
85 additions
and
50 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
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
31 changes: 31 additions & 0 deletions
31
03-api/src/test/scala/camundala/api/ProjectsConfigTest.scala
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,31 @@ | ||
package camundala.api | ||
|
||
import munit.FunSuite | ||
|
||
class ProjectsConfigTest extends FunSuite : | ||
|
||
test("colorForId should return the correct color for a given refName and ownProjectName") : | ||
val projectConfig1 = ProjectConfig("project1", ProjectGroup("group1"), "#ff0000") | ||
val projectConfig2 = ProjectConfig("project2", ProjectGroup("group2"), "#00ff00") | ||
val projectsConfig = ProjectsConfig(perGitRepoConfigs = Seq( | ||
ProjectsPerGitRepoConfig("https://example.com", Seq(projectConfig1, projectConfig2)) | ||
)) | ||
|
||
val result = projectsConfig.colorForId("project1-task", "project2") | ||
assertEquals(result, Some("project1" -> "#ff0000")) | ||
|
||
test("colorForId should return None if no matching project is found") : | ||
val projectConfig1 = ProjectConfig("project1", ProjectGroup("group1"), "#ff0000") | ||
val projectsConfig = ProjectsConfig(perGitRepoConfigs = Seq( | ||
ProjectsPerGitRepoConfig("https://example.com", Seq(projectConfig1)) | ||
)) | ||
val result = projectsConfig.colorForId("unknown-task", "project1") | ||
assertEquals(result, None) | ||
|
||
test("colorForId should return None if refName starts with ownProjectName") : | ||
val projectConfig1 = ProjectConfig("project1", ProjectGroup("group1"), "#ff0000") | ||
val projectsConfig = ProjectsConfig(perGitRepoConfigs = Seq( | ||
ProjectsPerGitRepoConfig("https://example.com", Seq(projectConfig1)) | ||
)) | ||
val result = projectsConfig.colorForId("project1-task", "project1") | ||
assertEquals(result, None) |
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
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
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