Skip to content

Commit

Permalink
Fix JS Examples
Browse files Browse the repository at this point in the history
  • Loading branch information
bitPogo committed Feb 23, 2024
1 parent 55bf273 commit 115870b
Showing 1 changed file with 20 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.test.runTest
import tech.antibytes.kfixture.fixture
import tech.antibytes.kfixture.kotlinFixture
import tech.antibytes.kfixture.listFixture
Expand Down Expand Up @@ -87,29 +88,27 @@ class SampleControllerAutoStubFactoryJsSpec {

// When
val controller = SampleController(local, remote)
return runBlockingTestWithTimeout {
val actual = controller.fetchAndStore(url)
val actual = controller.fetchAndStore(url)

// Then
actual mustBe domainObject

verify(exactly = 1) { remote._fetch.hasBeenStrictlyCalledWith(url) }
verify(exactly = 1) { local._store.hasBeenCalledWith(id[1]) }

collector.assertOrder {
remote._fetch.hasBeenStrictlyCalledWith(url)
domainObject._id.wasGotten()
domainObject._id.wasSet()
domainObject._id.wasGotten()
domainObject._value.wasGotten()
local._store.hasBeenCalledWith(id[1])
}
// Then
actual mustBe domainObject

verify(exactly = 1) { remote._fetch.hasBeenStrictlyCalledWith(url) }
verify(exactly = 1) { local._store.hasBeenCalledWith(id[1]) }

collector.assertOrder {
remote._fetch.hasBeenStrictlyCalledWith(url)
domainObject._id.wasGotten()
domainObject._id.wasSet()
domainObject._id.wasGotten()
domainObject._value.wasGotten()
local._store.hasBeenCalledWith(id[1])
}

collector.verifyOrder {
remote._fetch.hasBeenCalledWith(url)
domainObject._id.wasSetTo("42")
local._store.hasBeenCalledWith(id[1])
}
collector.verifyOrder {
remote._fetch.hasBeenCalledWith(url)
domainObject._id.wasSetTo("42")
local._store.hasBeenCalledWith(id[1])
}
}

Expand Down

0 comments on commit 115870b

Please sign in to comment.