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/LoginButton.js | 7 +++---
vnext/src/components/__tests__/LoginButton.test.js | 15 ++++++++----
.../__snapshots__/LoginButton.test.js.snap | 28 ++++++++--------------
.../__tests__/__snapshots__/UserLink.test.js.snap | 1 +
4 files changed, 24 insertions(+), 27 deletions(-)
(limited to 'vnext/src')
diff --git a/vnext/src/components/LoginButton.js b/vnext/src/components/LoginButton.js
index 92be22b8..cd26252e 100644
--- a/vnext/src/components/LoginButton.js
+++ b/vnext/src/components/LoginButton.js
@@ -9,7 +9,6 @@ import { useFormState } from 'react-use-form-state';
import { me, facebookLink, vkLink } from '../api';
function LoginButton({ onAuth, title }) {
-
const [open, setOpen] = useState(false);
const [formState, { text, password }] = useFormState();
@@ -18,7 +17,7 @@ function LoginButton({ onAuth, title }) {
event.preventDefault();
}
setOpen(!open);
- }
+ };
let onSubmit = (event) => {
event.preventDefault();
me(formState.values.username, formState.values.password)
@@ -29,7 +28,7 @@ function LoginButton({ onAuth, title }) {
).catch(ex => {
console.log(ex);
});
- }
+ };
return (
<>
@@ -88,4 +87,4 @@ const vkButtonStyle = {
background: '#4c75a3'
};
-export default LoginButton;
\ No newline at end of file
+export default LoginButton;
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(
-