Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save PaulWoodIII/22e4423291869707f4c2c551ef9f2196 to your computer and use it in GitHub Desktop.

Select an option

Save PaulWoodIII/22e4423291869707f4c2c551ef9f2196 to your computer and use it in GitHub Desktop.
TestSchedulers for Combine
import XCTest
import Combine
import Entwine
import EntwineTest
class EntwineTestSchedulerExampleTests: XCTestCase {
func testSchedulerInjection() {
let scheduler = TestScheduler(initialClock: 0)
var didSink = false
let sut = Just<Void>(())
// Inject the scheduler as a Dependency to your system under test
.delay(for: 1, scheduler: scheduler)
.sink { _ in
didSink = true
}
scheduler.resume()
XCTAssertTrue(didSink)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment