Skip to content

Commit

Permalink
Add regression test
Browse files Browse the repository at this point in the history
  • Loading branch information
ncooke3 committed Jan 27, 2024
1 parent d51c7ab commit 1ae8e6d
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Tests/PromisesTests/Promise+ThenTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1ae8e6d

Please sign in to comment.