diff --git a/packages/enzyme-test-suite/test/shared/hooks/useEffect.jsx b/packages/enzyme-test-suite/test/shared/hooks/useEffect.jsx index 4dff4e840..410c54ad9 100644 --- a/packages/enzyme-test-suite/test/shared/hooks/useEffect.jsx +++ b/packages/enzyme-test-suite/test/shared/hooks/useEffect.jsx @@ -158,26 +158,27 @@ export default function describeUseEffect({ expect(setDocumentTitle.args).to.deep.equal([[expectedCountString(0)]]); }); - // TODO: useEffect fixme - it.skip('on didupdate', () => { + it('on didupdate', () => { const wrapper = Wrap(); expect(setDocumentTitle).to.have.property('callCount', 1); - expect(setDocumentTitle.args).to.deep.equal([[expectedCountString(0)]]); + const [firstCall] = setDocumentTitle.args; + expect(firstCall).to.deep.equal([expectedCountString(0)]); expect(wrapper.find('p').text()).to.equal(expectedCountString(0)); - const { onClick } = wrapper.find('button').props(); - onClick(); + wrapper.find('button').invoke('onClick')(); expect(setDocumentTitle).to.have.property('callCount', 2); - expect(setDocumentTitle.args).to.deep.equal([[expectedCountString(1)]]); + const [, secondCall] = setDocumentTitle.args; + expect(secondCall).to.deep.equal([expectedCountString(1)]); expect(wrapper.find('p').text()).to.equal(expectedCountString(1)); - onClick(); - onClick(); + wrapper.find('button').invoke('onClick')(); + wrapper.find('button').invoke('onClick')(); expect(setDocumentTitle).to.have.property('callCount', 4); - expect(setDocumentTitle.args).to.deep.equal([[expectedCountString(3)]]); + const [,,, fourthCall] = setDocumentTitle.args; + expect(fourthCall).to.deep.equal([expectedCountString(3)]); expect(wrapper.find('p').text()).to.equal(expectedCountString(3)); }); }); @@ -240,7 +241,9 @@ export default function describeUseEffect({ wrapper.unmount(); - expect(ChatAPI.unsubscribeFromFriendStatus.calledOnceWith(friend.id)).to.equal(true); + expect(ChatAPI.unsubscribeFromFriendStatus).to.have.property('callCount', 1); + const [[firstArg]] = ChatAPI.unsubscribeFromFriendStatus.args; + expect(firstArg).to.equal(friend.id); }); }); });