Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

Commit

Permalink
Log unexpeted FlutterErrors in tests instead of throwing
Browse files Browse the repository at this point in the history
  • Loading branch information
stuartmorgan committed May 11, 2022
1 parent 8bbf789 commit ee91f76
Showing 1 changed file with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,21 @@ - (void)testTransformFix {
XCTestExpectation *initializedExpectation = [self expectationWithDescription:@"initialized"];
__block NSDictionary<NSString *, id> *initializationEvent;
[player onListenWithArguments:nil
eventSink:^(NSDictionary<NSString *, id> *event) {
if ([event[@"event"] isEqualToString:@"initialized"]) {
initializationEvent = event;
XCTAssertEqual(event.count, 4);
[initializedExpectation fulfill];
eventSink:^(id event) {
XCTAssertTrue([event isKindOfClass:[NSDictionary class]],
@"Unexpected event type: %@", event);
if ([event isKindOfClass:[NSDictionary class]]) {
NSDictionary<NSString *, id> *eventDictionary = event;
if ([eventDictionary[@"event"] isEqualToString:@"initialized"]) {
initializationEvent = eventDictionary;
XCTAssertEqual(eventDictionary.count, 4);
}
} else if ([event isKindOfClass:[FlutterError class]]) {
FlutterError *error = event;
XCTFail(@"%@: %@ (%@)", error.code, error.message, error.details);
}

[initializedExpectation fulfill];
}];
[self waitForExpectationsWithTimeout:30.0 handler:nil];

Expand Down

0 comments on commit ee91f76

Please sign in to comment.