0%

XCTest

异步

处理异步事件 XCTestExpectation

1
2
3
4
5
6
7
8
9
10
11
12
13
14
XCTestExpectation* exception = [self expectationWithDescription:@"metadata"];

NetWrok *req = [NetWrok new] ;
[req startWithCompletionBlockWithSuccess:^(LDBaseRequest *request) {
[exception fulfill];
} failure:^(LDBaseRequest *request) {
XCTAssertNil(request.error);
[exception fulfill];
}];

[self waitForExpectationsWithTimeout:50 handler:^(NSError * _Nullable error) {
XCTAssertNil(error);
}];

参考