mirror of
https://github.com/google/promises
synced 2026-11-09 22:26:00 +05:45
Add regression test
This commit is contained in:
1 parent
d51c7abaef
commit
1ae8e6d3b2
1 file changed
+17
@@ -59,6 +59,23 @@ class PromiseThenTests: XCTestCase {
|
||||
XCTAssertNil(postFinalPromise.error)
|
||||
}
|
||||
|
||||
func testPromiseWhenNilBridgesToNSNullInThenChain() {
|
||||
// Act.
|
||||
let promise = Promise<Any?> { fulfill, _ in
|
||||
fulfill(nil)
|
||||
}.catch { _ in
|
||||
XCTFail()
|
||||
}.then { value in
|
||||
XCTAssert(value is NSNull)
|
||||
}
|
||||
|
||||
// Assert.
|
||||
XCTAssert(waitForPromises(timeout: 10))
|
||||
XCTAssertTrue(promise.isFulfilled)
|
||||
XCTAssert(promise.value is NSNull)
|
||||
XCTAssertNil(promise.error)
|
||||
}
|
||||
|
||||
func testPromiseAsyncFulfill() {
|
||||
// Act.
|
||||
let promise = Promise { fulfill, _ in
|
||||
|
||||
Reference in new issue
Block a user