Add PromiseKit dependency

- Added PromiseKit dependency
This commit is contained in:
2018-11-15 22:08:00 -04:00
parent 2689d86c18
commit be7b6b5881
541 changed files with 46282 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
@import PMKStoreKit;
@import PromiseKit;
@import StoreKit;
@import XCTest;
@implementation PMKSKProductsRequest: SKProductsRequest
- (void)start {
PMKAfter(0.5).then(^{
[self.delegate productsRequest:self didReceiveResponse:[SKProductsResponse new]];
});
}
@end
@implementation SKProductsRequestTests: XCTestCase
- (void)test {
id ex = [self expectationWithDescription:@""];
SKProductsRequest *rq = [PMKSKProductsRequest new];
[rq promise].then(^{
[ex fulfill];
});
[self waitForExpectationsWithTimeout:1 handler:nil];
}
@end

View File

@@ -0,0 +1,22 @@
import PMKStoreKit
import PromiseKit
import StoreKit
import XCTest
class SKProductsRequestTests: XCTestCase {
func test() {
class MockProductsRequest: SKProductsRequest {
override func start() {
after(seconds: 0.1).done {
self.delegate?.productsRequest(self, didReceive: SKProductsResponse())
}
}
}
let ex = expectation(description: "")
MockProductsRequest().start(.promise).done { _ in
ex.fulfill()
}
waitForExpectations(timeout: 1, handler: nil)
}
}