Skip to content

Commit

Permalink
fix broken test due to error message change
Browse files Browse the repository at this point in the history
Summary:
## Context
The error message in folly dynamic has been updated in D62136190. Updating related tests to reflect the change.

## Diff
Only test code is changed. No business logic change.

## Changelog:
[Internal] [Fixed] - Fix broken unit test due to folly error message change

X-link: facebook/react-native#46329

```
Shows details about the selected run from the run history
Run result
java.lang.AssertionError: Test failure
Test Case RecoverableError
* Running RecoverableError.RunRethrowingAsRecoverableRecoverTest
* Running RecoverableError.RunRethrowingAsRecoverableFallthroughTest
2/2 tests passed.
Test Case JsArgumentHelpersTest
* Running JsArgumentHelpersTest.args
***** Failure in xplat/js/react-native-github/packages/react-native/ReactCommon/cxxreact/tests/jsarg_helpers.cpp:108
Expected equality of these values:
  ex.what()
    Which is: "Error converting javascript arg 4 to C++: TypeError: expected dynamic type 'int/double/bool/string', but had type 'array'"
  std::string("Error converting javascript arg 4 to C++: " "TypeError: expected dynamic type `int/double/bool/string', but had type `array'")
    Which is: "Error converting javascript arg 4 to C++: TypeError: expected dynamic type `int/double/bool/string', but had type `array'"

0/1 tests passed.
Test Case JSBigFileString
```

Reviewed By: yfeldblum

Differential Revision: D62184078

fbshipit-source-id: 6ae0a33f58e0e10f14166084b80a997e59a008ec
  • Loading branch information
Qi Zhao authored and facebook-github-bot committed Sep 4, 2024
1 parent 9480501 commit 0829195
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions folly/json/test/DynamicParserTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ TEST(TestDynamicParser, TestRequiredOptionalParseErrors) {
};
// clang-format off
EXPECT_EQ(dynamic(dynamic::object("nested", dynamic::object
("x", get_expected_error_fn("x", "TypeError: .* but had type `array'"))
("x", get_expected_error_fn("x", "TypeError: .* but had type 'array'"))
("y", get_expected_error_fn("y", ".*Invalid leading character.*"))
("z", get_expected_error_fn("z", "CUSTOM")))), errors);
// clang-format on
Expand Down Expand Up @@ -311,7 +311,7 @@ TEST(TestDynamicParser, TestItemParseErrors) {
},
"string",
"string",
"TypeError: .* but had type `array'");
"TypeError: .* but had type 'array'");
checkItemParseError(
dynamic::array("this is not a bool"),
[&](DynamicParser& p) { p.arrayItems([&](int64_t, bool) {}); },
Expand Down

0 comments on commit 0829195

Please sign in to comment.