From 8b89db6d5cfeeaf55ca2614bf8fcf8425917f165 Mon Sep 17 00:00:00 2001 From: Lukas Heiligenbrunner Date: Thu, 16 Jul 2020 19:13:54 +0200 Subject: [PATCH] fixing failing test --- src/App.js | 2 +- src/App.test.js | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/App.js b/src/App.js index e3a4350..56a9467 100644 --- a/src/App.js +++ b/src/App.js @@ -42,7 +42,7 @@ class App extends React.Component { newElement = null; - constructViewBinding(){ + constructViewBinding() { return { changeRootElement: this.changeRootElement, returnToLastElement: this.returnToLastElement diff --git a/src/App.test.js b/src/App.test.js index 60f58e3..d69a1f0 100644 --- a/src/App.test.js +++ b/src/App.test.js @@ -100,15 +100,14 @@ describe('', function () { const wrapper = shallow(); + + const func = jest.fn(); + wrapper.instance().setState = func; + expect(global.fetch).toBeCalledTimes(1); process.nextTick(() => { - console.log(wrapper.state()); - - // todo state lifecycle not triggered - wrapper.update(); - console.log(wrapper.state()); - expect(wrapper.state('passwordsupport')).toBe(true); + expect(func).toBeCalledTimes(1); global.fetch.mockClear(); done();