@samitouri / QOS-React-2 / commits / 22ba8b67f1

Silence console.error in ReactDOMInput-test

This test is expected to throw but because of ReactErrorUtils.guard which uses console.error in __DEV__ it also logged the invariant error to the console. This change fixes it by temporarily stubbing out console.error. Fixes #531

Christoph Pojer committed Jan 6, 2014 at 09:43 UTC 22ba8b67f136915de9d1b76384b78f4de5d75d15
1 file changed +5
src/dom/components/__tests__/ReactDOMInput-test.js
+5
@@ -199,6 +199,11 @@ describe('ReactDOMInput', function() {
199 });
200
201 it('should throw if both value and valueLink are provided', function() {
202 + // Silences console.error messages
203 + // ReactErrorUtils.guard is applied to all methods of a React component
204 + // and calls console.error in __DEV__ (true for test environment)
205 + spyOn(console, 'error');
206 +
207 var node = document.createElement('div');
208 var link = new ReactLink('yolo', mocks.getMockFunction());
209 var instance = <input type="text" valueLink={link} />;