Skip to content
This repository was archived by the owner on May 8, 2024. It is now read-only.

Commit 0be7ca3

Browse files
Merge pull request #53 from stack-spot/bugfix/mock-unit-test
Bug Fix: Add mock for git config command runner
2 parents 68cabc9 + a57989f commit 0be7ca3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/test/kotlin/com/stackspot/intellij/services/CreateProjectServiceTest.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ internal class CreateProjectServiceTest {
4848

4949
@Nested
5050
inner class FailureCases {
51+
5152
@Test
5253
fun `service state should be STACKFILES_EMPTY`() {
5354
every { importedStacks.hasStackFiles() } returns false
@@ -95,6 +96,7 @@ internal class CreateProjectServiceTest {
9596

9697
@Nested
9798
inner class SuccessCases {
99+
98100
@Test
99101
fun `should clear service attributes`() {
100102
val service = CreateProjectService().saveInfo(createStack(), createStackfile())
@@ -109,9 +111,11 @@ internal class CreateProjectServiceTest {
109111
@Test
110112
fun `service state should be OK`() {
111113
every { importedStacks.hasStackFiles() } returns true
112-
val service = CreateProjectService(importedStacks, isInstalled = true)
114+
every { (gitConfigCmd.runner as BackgroundCommandRunner).stdout } returns "ok"
115+
val service = CreateProjectService(importedStacks, isInstalled = true, gitConfigCmd = gitConfigCmd)
113116
service.state shouldBe ProjectWizardState.OK
114117
verify { importedStacks.hasStackFiles() }
118+
verify(exactly = 2) { gitConfigCmd.run() }
115119
confirmVerified(importedStacks)
116120
}
117121

0 commit comments

Comments
 (0)