From c869329d6e961a9758a4671b9a2f1872e909b1e4 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Sun, 7 Apr 2019 23:30:05 +0300 Subject: Fix tests and update snapshots --- vnext/src/components/__tests__/LoginButton.test.js | 15 ++++++++---- .../__snapshots__/LoginButton.test.js.snap | 28 ++++++++-------------- .../__tests__/__snapshots__/UserLink.test.js.snap | 1 + 3 files changed, 21 insertions(+), 23 deletions(-) (limited to 'vnext/src/components/__tests__') diff --git a/vnext/src/components/__tests__/LoginButton.test.js b/vnext/src/components/__tests__/LoginButton.test.js index be083c22..da80abb0 100644 --- a/vnext/src/components/__tests__/LoginButton.test.js +++ b/vnext/src/components/__tests__/LoginButton.test.js @@ -1,16 +1,21 @@ import React from 'react'; import LoginButton from '../LoginButton'; -import renderer from 'react-test-renderer'; +import { create, act } from 'react-test-renderer'; test('Login button and form are renders correctly', () => { - const button = renderer.create( - {}} /> - ); + var button = null; + act(() => { + button = create( + { }} /> + ); + }); let link = button.toJSON(); expect(link).toMatchSnapshot(); - button.root.instance.toggleModal(); + act(() => { + button.root.findByType('a').props.onClick(); + }); let modal = button.toJSON(); expect(modal).toMatchSnapshot(); }); diff --git a/vnext/src/components/__tests__/__snapshots__/LoginButton.test.js.snap b/vnext/src/components/__tests__/__snapshots__/LoginButton.test.js.snap index e5c4ebe5..e2e36e24 100644 --- a/vnext/src/components/__tests__/__snapshots__/LoginButton.test.js.snap +++ b/vnext/src/components/__tests__/__snapshots__/LoginButton.test.js.snap @@ -49,17 +49,6 @@ Array [ ,


- +
diff --git a/vnext/src/components/__tests__/__snapshots__/UserLink.test.js.snap b/vnext/src/components/__tests__/__snapshots__/UserLink.test.js.snap index 996e592a..15e25367 100644 --- a/vnext/src/components/__tests__/__snapshots__/UserLink.test.js.snap +++ b/vnext/src/components/__tests__/__snapshots__/UserLink.test.js.snap @@ -23,6 +23,7 @@ Array [ ugnich , -- cgit v1.2.3