Skip to content

Commit

Permalink
feat: add more tests on all classes using DiagramIndexViewModel
Browse files Browse the repository at this point in the history
  • Loading branch information
galuszkak committed Nov 9, 2024
1 parent 65c4f81 commit 569f689
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import com.structurizr.model.SoftwareSystem
import com.structurizr.model.StaticStructureElement
import com.structurizr.view.ViewSet
import nl.avisi.structurizr.site.generatr.site.GeneratorContext
import nl.avisi.structurizr.site.generatr.site.model.DiagramViewModel
import nl.avisi.structurizr.site.generatr.site.model.ImageViewViewModel

val Workspace.includedSoftwareSystems: List<SoftwareSystem>
get() = model.softwareSystems.filter {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,12 @@ class SoftwareSystemContainerComponentCodePageViewModelTest : ViewModelTest() {

assertThat(viewModel.visible).isFalse()
}

@Test
fun `show list is disabled`() {
val viewModel = SoftwareSystemContainerComponentCodePageViewModel(generatorContext, backendContainer, backendComponent)
assertThat(viewModel.diagramIndex.showList).isFalse()


}
}
Original file line number Diff line number Diff line change
Expand Up @@ -148,4 +148,10 @@ class SoftwareSystemContainerComponentsPageViewModelTest : ViewModelTest() {
val viewModel = SoftwareSystemContainerComponentsPageViewModel(generatorContext, softwareSystem.addContainer("Container"))
assertThat(viewModel.visible).isFalse()
}

@Test
fun `show list is enabled`() {
val viewModel = SoftwareSystemContainerComponentsPageViewModel(generatorContext, backendContainer)
assertThat(viewModel.diagramIndex.showList).isTrue()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,10 @@ class SoftwareSystemContainerPageViewModelTest : ViewModelTest() {

assertThat(viewModel.visible).isFalse()
}

@Test
fun `show list is enabled`() {
val viewModel = SoftwareSystemContainerPageViewModel(generatorContext, softwareSystem)
assertThat(viewModel.diagramIndex.showList).isTrue()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import assertk.assertThat
import assertk.assertions.containsExactly
import assertk.assertions.isEqualTo
import assertk.assertions.isFalse
import assertk.assertions.isTrue
import com.structurizr.model.SoftwareSystem
import kotlin.test.Test

Expand Down Expand Up @@ -62,4 +63,10 @@ class SoftwareSystemDeploymentPageViewModelTest : ViewModelTest() {

assertThat(viewModel.visible).isFalse()
}

@Test
fun `show list is enabled`() {
val viewModel = SoftwareSystemDeploymentPageViewModel(generatorContext, softwareSystem)
assertThat(viewModel.diagramIndex.showList).isTrue()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import assertk.assertThat
import assertk.assertions.containsExactly
import assertk.assertions.isEqualTo
import assertk.assertions.isFalse
import assertk.assertions.isTrue
import com.structurizr.model.SoftwareSystem
import kotlin.test.Test

Expand Down Expand Up @@ -64,4 +65,10 @@ class SoftwareSystemDynamicPageViewModelTest : ViewModelTest() {

assertThat(viewModel.visible).isFalse()
}

@Test
fun `show list is enabled`() {
val viewModel = SoftwareSystemDynamicPageViewModel(generatorContext, softwareSystem)
assertThat(viewModel.diagramIndex.showList).isTrue()
}
}

0 comments on commit 569f689

Please sign in to comment.