Skip to content

Commit

Permalink
Added a test for MenuViewModel.SoftwareSystemsNodes
Browse files Browse the repository at this point in the history
  • Loading branch information
qtzar committed Oct 12, 2023
1 parent 15b75c7 commit 407e10a
Showing 1 changed file with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,27 @@ class MenuViewModelTest : ViewModelTest() {
}
}

@Test
fun `show nested groups in software systems list`() {
val generatorContext = generatorContext(branches = listOf("main", "branch-2"), currentBranch = "main")
generatorContext.workspace.views.configuration.addProperty("generatr.site.nestGroups","true")
generatorContext.workspace.model.addSoftwareSystem("System 1").group = "Group 1"
generatorContext.workspace.model.addSoftwareSystem("System 2").group = "Group 1"
generatorContext.workspace.model.addSoftwareSystem("System 3").group = "Group 2"
generatorContext.workspace.model.addSoftwareSystem("System 4").group = "Group 1/Group 3"

MenuViewModel(generatorContext, createPageViewModel(generatorContext, url = HomePageViewModel.url()))
.let {
assertThat(it.softwareSystemNodes().children).hasSize(2)
assertThat(it.softwareSystemNodes().children[0].name).isEqualTo("Group 1")
assertThat(it.softwareSystemNodes().children[0].children).hasSize(3)
assertThat(it.softwareSystemNodes().children[0].children[0].name).isEqualTo("Group 3")
assertThat(it.softwareSystemNodes().children[0].children[0].children[0].name).isEqualTo("System 4")
}


}

private fun createPageViewModel(generatorContext: GeneratorContext, url: String = "/master/page"): PageViewModel {
return object : PageViewModel(generatorContext) {
override val url = url
Expand Down

0 comments on commit 407e10a

Please sign in to comment.