Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
describe("FetcherTwo") {
lateinit var asyncQueue: AsyncQueue
lateinit var fetcher: FetcherTwo
val client = Client()
beforeEachTest {
asyncQueue = AsyncQueue()
fetcher = FetcherTwo(asyncQueue, client)
}
it("perform - calls client to do other stuff") {
client.mockResponseStatus("successful")
fetcher.perform()
assertThat(client.actions).contains("doSomeOtherStuff")
}
it("perform - does not trigger async polling") {
client.mockResponseStatus("successful")
fetcher.perform()
assertThat(asyncQueue).isEmpty()
}
it("perform - triggers async polling job when accepted") {
client.mockResponseStatus("accepted")
fetcher.perform()
assertThat(asyncQueue).contains(fetcher::checkLastOperation)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.