@samitouri / QOS-React-2 / commits / d16754125f

More consistent error message for findRenderedDOMComponentWithX

Tay Yang Shun committed Nov 6, 2015 at 03:05 UTC d16754125f3b8224ff0892702ee5e84f697f2c55
1 file changed +8 -6
src/test/ReactTestUtils.js
+8 -6
@@ -207,8 +207,9 @@ var ReactTestUtils = {
207 var all =
208 ReactTestUtils.scryRenderedDOMComponentsWithClass(root, className);
209 if (all.length !== 1) {
210 - throw new Error('Did not find exactly one match ' +
211 - '(found: ' + all.length + ') for class:' + className
210 + throw new Error(
211 + 'Did not find exactly one match (found: ' + all.length + ') ' +
212 + 'for class:' + className
213 );
214 }
215 return all[0];
@@ -236,8 +237,9 @@ var ReactTestUtils = {
237 findRenderedDOMComponentWithTag: function(root, tagName) {
238 var all = ReactTestUtils.scryRenderedDOMComponentsWithTag(root, tagName);
239 if (all.length !== 1) {
239 - throw new Error('Did not find exactly one match ' +
240 - '(found ' + all.length + ') for tag:' + tagName
240 + throw new Error(
241 + 'Did not find exactly one match (found: ' + all.length + ') ' +
242 + 'for tag:' + tagName
243 );
244 }
245 return all[0];
@@ -270,8 +272,8 @@ var ReactTestUtils = {
272 );
273 if (all.length !== 1) {
274 throw new Error(
273 - 'Did not find exactly one match for componentType:' + componentType +
274 - ' (found ' + all.length + ')'
275 + 'Did not find exactly one match (found: ' + all.length + ') ' +
276 + 'for componentType:' + componentType
277 );
278 }
279 return all[0];