@samitouri / QOS-React-2 / commits / 72ba8db504

Added unit test that would have caught the recent error code transform regression (#11356)

* Added an automated test that would have caught the recent error code transform bug * Renamed dev-expression-with-codes test to replace-invariant-error-codes * Formatting nit

Brian Vaughn committed Oct 25, 2017 at 08:21 UTC 72ba8db504156579742915320ce10761b1aee54e
1 file changed +9
scripts/error-codes/__tests__/replace-invariant-error-codes-test.js renamed
+9
@@ -93,4 +93,13 @@ ${expectedInvariantTransformResult}`
93 `_prodInvariant('18', 'Foo', 'Bar') : void 0;`
94 );
95 });
96 +
97 + it('should correctly transform invariants that are not in the error codes map', () => {
98 + compare(
99 + "invariant(condition, 'This is not a real error message.');",
100 + `var _prodInvariant = require('shared/reactProdInvariant');
101 +
102 +!condition ? invariant(false, 'This is not a real error message.') : void 0;`
103 + );
104 + });
105 });