jeudi 28 avril 2016

RxSwift Unit Testing

I have a simple RxSwift Observable sequence that I am trying to unit test.

    var pass = false
    _ = service!.authenticate().subscribeNext { res in
        XCTAssert(res.tokenValue == "abc123")
        pass = true
    }
    XCTAssertTrue(pass)

This test will fail intermittently as if the subscribeNext block isn't hit. Any ideas on what I'm doing wrong?

Aucun commentaire:

Enregistrer un commentaire