From f199138fa0b570e486aa3e2e6f4e7149a6b68b2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Eduardo=20Ferreira=20Bertacchi?= Date: Fri, 21 Dec 2018 11:27:11 -0200 Subject: [PATCH] refactor: Test If component with no hack --- .../solution/src/If.test.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/react-fundamentals/2-iniciando-com-testes-em-react-solution/solution/src/If.test.js b/react-fundamentals/2-iniciando-com-testes-em-react-solution/solution/src/If.test.js index a2d47106..e2afe770 100644 --- a/react-fundamentals/2-iniciando-com-testes-em-react-solution/solution/src/If.test.js +++ b/react-fundamentals/2-iniciando-com-testes-em-react-solution/solution/src/If.test.js @@ -2,17 +2,16 @@ import React from 'react'; import { shallow } from 'enzyme'; import If from './If'; -// Beware: this is a very hacky test suite. describe('[Component] If', () => { - const children = 'hello, world!' + const children =

Hello, World!

; it('renders null if test is false', () => { const wrapper = shallow(); - expect(wrapper.debug()).toBe(""); + expect(wrapper.getElement()).toEqual(null); }); it('renders children if test is true', () => { const wrapper = shallow(); - expect(wrapper.debug()).toEqual(children); + expect(wrapper.getElement()).toEqual(children); }); -}); \ No newline at end of file +});