mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Update TurboModuleTestFixture to handle Promise types (#52801)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/52801 Changelog: [Internal] This adds utility functions and sample test cases to verify AsyncPromises in GTests Reviewed By: lenaic Differential Revision: D78871865 fbshipit-source-id: 41a7bebee94f40ec2d1d84b3ceae561dc503b421
This commit is contained in:
committed by
Facebook GitHub Bot
parent
6d52cf5662
commit
c7c8ce0cad
@@ -154,6 +154,16 @@ TEST_F(NativeCxxModuleExampleTests, GetValueReturnsCorrectValues) {
|
||||
EXPECT_EQ(result.z.c, "seven");
|
||||
}
|
||||
|
||||
TEST_F(NativeCxxModuleExampleTests, GetValueWithPromiseReturnsCorrectValues) {
|
||||
auto promise1 = module_->getValueWithPromise(*runtime_, false);
|
||||
auto result = resolvePromise(promise1);
|
||||
EXPECT_EQ(result, "result!");
|
||||
|
||||
auto promise2 = module_->getValueWithPromise(*runtime_, true);
|
||||
auto message = handleError(promise2);
|
||||
EXPECT_EQ(message, "intentional promise rejection");
|
||||
}
|
||||
|
||||
TEST_F(
|
||||
NativeCxxModuleExampleTests,
|
||||
GetWithWithOptionalArgsReturnsCorrectValues) {
|
||||
|
||||
Reference in New Issue
Block a user