Skip to content

Commit

Permalink
test host error callback
Browse files Browse the repository at this point in the history
Differential Revision: D46672582

fbshipit-source-id: 92b8dd30091ad5d836eb9288510ba48cbea3479e
  • Loading branch information
philIip authored and facebook-github-bot committed Jun 14, 2023
1 parent 8b33078 commit 09070f5
Showing 1 changed file with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,35 @@ - (void)testCallFunctionOnJSModule
XCTAssertEqualObjects(shimmedRCTInstance.args, args);
}

- (void)testDidReceiveErrorStack
{
id<RCTInstanceDelegate> instanceDelegate = (id<RCTInstanceDelegate>)_subject;

NSMutableArray<NSDictionary<NSString *, id> *> *stack = [NSMutableArray array];

NSMutableDictionary<NSString *, id> *stackFrame0 = [NSMutableDictionary dictionary];
stackFrame0[@"linenumber"] = @(3);
stackFrame0[@"column"] = @(4);
stackFrame0[@"methodname"] = @"method1";
stackFrame0[@"file"] = @"file1.js";
[stack addObject:stackFrame0];

NSMutableDictionary<NSString *, id> *stackFrame1 = [NSMutableDictionary dictionary];
stackFrame0[@"linenumber"] = @(63);
stackFrame0[@"column"] = @(44);
stackFrame0[@"methodname"] = @"method2";
stackFrame0[@"file"] = @"file2.js";
[stack addObject:stackFrame1];

[instanceDelegate instance:OCMClassMock([RCTInstance class])
didReceiveJSErrorStack:stack
message:@"message"
exceptionId:5
isFatal:YES];

OCMVerify(
OCMTimes(1),
[_mockHostDelegate host:_subject didReceiveJSErrorStack:stack message:@"message" exceptionId:5 isFatal:YES]);
}

@end

0 comments on commit 09070f5

Please sign in to comment.