Add regression test

This commit is contained in:
Nick Cooke committed 2024-01-27 11:25:18 -05:00
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