aboutsummaryrefslogtreecommitdiff
path: root/vnext/src/ui
diff options
context:
space:
mode:
Diffstat (limited to 'vnext/src/ui')
-rw-r--r--vnext/src/ui/UserInfo.js2
-rw-r--r--vnext/src/ui/__tests__/MessageInput-test.js4
-rw-r--r--vnext/src/ui/__tests__/UserLink.test.js26
3 files changed, 20 insertions, 12 deletions
diff --git a/vnext/src/ui/UserInfo.js b/vnext/src/ui/UserInfo.js
index cb6ad792..3890d0bc 100644
--- a/vnext/src/ui/UserInfo.js
+++ b/vnext/src/ui/UserInfo.js
@@ -104,6 +104,8 @@ export function UserLink(props) {
if (isMounted) {
setUser(response.data);
}
+ }).catch(reason => {
+ // TODO: debug logging
});
}
return () => {
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();
});