Skip to content

Instantly share code, notes, and snippets.

@waterlink
Created February 9, 2019 12:55
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
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