Skip to content

Commit

Permalink
Fix errors with item moving logic
Browse files Browse the repository at this point in the history
  • Loading branch information
anotheroneofthese committed Oct 9, 2024
1 parent 82b2684 commit 98113d5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/main/kotlin/no/nb/mlt/wls/domain/WLSService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ class WLSService(
throw ValidationException("Location can not be blank")
}
val item = getItem(hostName, hostId) ?: throw ItemNotFoundException("Item with id '$hostId' does not exist for '$hostName'")
itemRepository.moveItem(item.hostId, item.hostName, quantity, location)
inventoryNotifier.itemChanged(item)
return item
val movedItem = itemRepository.moveItem(item.hostId, item.hostName, quantity, location)
inventoryNotifier.itemChanged(movedItem)
return movedItem
}

override suspend fun createOrder(orderDTO: CreateOrderDTO): Order {
Expand Down
2 changes: 2 additions & 0 deletions src/test/kotlin/no/nb/mlt/wls/domain/WLSServiceTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import io.mockk.clearAllMocks
import io.mockk.coEvery
import io.mockk.coJustRun
import io.mockk.coVerify
import io.mockk.every
import io.mockk.mockk
import kotlinx.coroutines.test.runTest
import no.nb.mlt.wls.domain.model.Environment
Expand Down Expand Up @@ -133,6 +134,7 @@ class WLSServiceTest {
)
coEvery { itemRepoMock.getItem(any(), any()) } returns testItem
coEvery { itemRepoMock.moveItem(any(), any(), any(), any()) } returns expectedItem
every { inventoryNotifierMock.itemChanged(any()) } answers {}

val cut = WLSService(itemRepoMock, orderRepoMock, storageSystemRepoMock, inventoryNotifierMock)
runTest {
Expand Down

0 comments on commit 98113d5

Please sign in to comment.