Update test case to make it more solid

This commit is contained in:
DreamPiggy 2020-11-22 12:57:32 +08:00
parent 91b8caf6d2
commit 99c59ac52b
1 changed files with 13 additions and 11 deletions

View File

@ -63,7 +63,7 @@
if (image && data && !error && finished) {
[expectation fulfill];
} else {
XCTFail(@"Something went wrong");
XCTFail(@"Something went wrong: %@", error.description);
}
}];
[self waitForExpectationsWithCommonTimeout];
@ -130,7 +130,7 @@
if (image && data && !error && finished) {
[expectation fulfill];
} else {
XCTFail(@"Something went wrong");
XCTFail(@"Something went wrong: %@", error.description);
}
}];
[self waitForExpectationsWithCommonTimeoutUsingHandler:^(NSError * _Nullable error) {
@ -145,7 +145,7 @@
if (image && data && !error && finished) {
[expectation fulfill];
} else if (finished) {
XCTFail(@"Something went wrong");
XCTFail(@"Something went wrong: %@", error.description);
} else {
// progressive updates
}
@ -161,7 +161,7 @@
if (!image && !data && error && finished) {
[expectation fulfill];
} else {
XCTFail(@"Something went wrong");
XCTFail(@"Something went wrong: %@", error.description);
}
}];
[self waitForExpectationsWithCommonTimeout];
@ -227,7 +227,7 @@
if (image && data && !error && finished) {
[expectation fulfill];
} else {
XCTFail(@"Something went wrong");
XCTFail(@"Something went wrong: %@", error.description);
}
}];
@ -243,7 +243,7 @@
if (image && data && !error && finished) {
[expectation fulfill];
} else {
XCTFail(@"Something went wrong");
XCTFail(@"Something went wrong: %@", error.description);
}
}];
[self waitForExpectationsWithCommonTimeout];
@ -256,7 +256,7 @@
if (image && data && !error && finished) {
[expectation fulfill];
} else {
XCTFail(@"Something went wrong");
XCTFail(@"Something went wrong: %@", error.description);
}
}];
[self waitForExpectationsWithCommonTimeout];
@ -353,6 +353,8 @@
} completed:^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, BOOL finished) {
if (allProgressCount > 0) {
[expectation fulfill];
allProgressCount = 0;
return;
} else {
XCTFail(@"Progress callback more than once");
}
@ -370,7 +372,7 @@
if (image && data && !error && finished) {
[expectation fulfill];
} else if (finished) {
XCTFail(@"Something went wrong");
XCTFail(@"Something went wrong: %@", error.description);
} else {
// progressive updates
}
@ -385,7 +387,7 @@
if (image && data && !error && finished) {
[expectation fulfill];
} else if (finished) {
XCTFail(@"Something went wrong");
XCTFail(@"Something went wrong: %@", error.description);
} else {
// progressive updates
}
@ -422,7 +424,7 @@
if (image && data && !error && finished) {
[expectation fulfill];
} else {
XCTFail(@"Something went wrong");
XCTFail(@"Something went wrong: %@", error.description);
}
}];
expect(token2).toNot.beNil();
@ -464,7 +466,7 @@
[expectation fulfill];
} else {
NSLog(@"image = %@, data = %@, error = %@", image, data, error);
XCTFail(@"Something went wrong");
XCTFail(@"Something went wrong: %@", error.description);
}
}];
expect(token2).toNot.beNil();