aboutsummaryrefslogtreecommitdiff
path: root/vnext/src/ui/__tests__
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2021-06-08 00:30:40 +0300
committerGravatar Vitaly Takmazov2023-01-13 10:37:57 +0300
commit25bddaf76b21535de2ea3f24816a3c09ea37bd78 (patch)
treeae2996098b2a3dbd70e961a066bead92e8ae588d /vnext/src/ui/__tests__
parent2aacd8aec317b6ff7c173fb381d482a0be09a437 (diff)
Fix tests
Diffstat (limited to 'vnext/src/ui/__tests__')
-rw-r--r--vnext/src/ui/__tests__/MessageInput-test.js4
-rw-r--r--vnext/src/ui/__tests__/UserLink.test.js26
2 files changed, 18 insertions, 12 deletions
diff --git a/vnext/src/ui/__tests__/MessageInput-test.js b/vnext/src/ui/__tests__/MessageInput-test.js
index 261786d0..12b85bca 100644
--- a/vnext/src/ui/__tests__/MessageInput-test.js
+++ b/vnext/src/ui/__tests__/MessageInput-test.js
@@ -1,3 +1,7 @@
+/**
+ * @jest-environment jsdom
+ */
+
import { create, act } from 'react-test-renderer';
import MessageInput from '../MessageInput';
diff --git a/vnext/src/ui/__tests__/UserLink.test.js b/vnext/src/ui/__tests__/UserLink.test.js
index 30c35928..6bb4da29 100644
--- a/vnext/src/ui/__tests__/UserLink.test.js
+++ b/vnext/src/ui/__tests__/UserLink.test.js
@@ -1,19 +1,21 @@
-import { MemoryRouter, Switch, Route } from 'react-router-dom';
+import { MemoryRouter } from 'react-router-dom';
import { UserLink } from '../UserInfo';
-import renderer from 'react-test-renderer';
+import renderer, { act } from 'react-test-renderer';
test('UserLink renders correctly', async () => {
- const component = renderer.create(
- <MemoryRouter>
- <>
- <UserLink user={{ uid: 1, uname: 'ugnich', avatar: 'https://juick.com/i/a/1-deadbeef.png' }} />
- <UserLink user={{ uid: 1, uname: 'ugnich', avatar: 'https://juick.com/i/a/1-deadbeef.png', uri: '' }} />
- <UserLink user={{ uid: 0, uname: '', uri: 'https://example.com/u/test' }} />
- </>
- </MemoryRouter>
- );
- await Promise.resolve();
+ let component = null;
+ act(() => {
+ component = renderer.create(
+ <MemoryRouter>
+ <>
+ <UserLink user={{ uid: 1, uname: 'ugnich', avatar: 'https://juick.com/i/a/1-deadbeef.png' }} />
+ <UserLink user={{ uid: 1, uname: 'ugnich', avatar: 'https://juick.com/i/a/1-deadbeef.png', uri: '' }} />
+ <UserLink user={{ uid: 0, uname: '', uri: 'https://example.com/u/test' }} />
+ </>
+ </MemoryRouter>
+ );
+ });
let tree = component.toJSON();
expect(tree).toMatchSnapshot();
});