aboutsummaryrefslogtreecommitdiff
path: root/vnext
diff options
context:
space:
mode:
Diffstat (limited to 'vnext')
-rw-r--r--vnext/src/api/index.js2
-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
4 files changed, 21 insertions, 13 deletions
diff --git a/vnext/src/api/index.js b/vnext/src/api/index.js
index 2392bfd0..8f452b82 100644
--- a/vnext/src/api/index.js
+++ b/vnext/src/api/index.js
@@ -220,6 +220,6 @@ export function fetchUserUri(dataUri) {
return new Promise((resolve, reject) => {
let form = new FormData();
form.append('uri', dataUri);
- client.post('/u/', form).then(response => resolve(response));
+ client.post('/u/', form).then(response => resolve(response)).catch(reject);
});
}
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();
});