Skip to content

Commit

Permalink
fix: flaky test
Browse files Browse the repository at this point in the history
  • Loading branch information
liuyang1520 committed Jun 29, 2023
1 parent f417213 commit f181eb3
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions Tests/AmplitudeTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -1620,10 +1620,9 @@ - (void)testObserveDidFinishLaunchingNotificationWithPreviousBuild {

[client flushQueue];

// This check is not ideal, to avoid flaky test, we only check the first event prefix.
NSDictionary *event1 = [client getLastEventFromInstanceName:instanceName fromEnd: 1];
XCTAssertEqualObjects([event1 objectForKey:@"event_type"], @"[Amplitude] Application Updated");
XCTAssertEqualObjects([[event1 objectForKey:@"event_properties"] objectForKey:@"[Amplitude] Previous Build"], @"test");
XCTAssertEqualObjects([[event1 objectForKey:@"event_properties"] objectForKey:@"[Amplitude] Previous Version"], @"test");
XCTAssertTrue([[event1 objectForKey:@"event_type"] hasPrefix:@"[Amplitude] Application"]);

NSDictionary *event2 = [client getLastEventFromInstanceName:instanceName fromEnd: 0];
XCTAssertEqualObjects([event2 objectForKey:@"event_type"], @"[Amplitude] Application Opened");
Expand Down

0 comments on commit f181eb3

Please sign in to comment.