Skip to content

Commit cc52fc2

Browse files
committed
test: formatError
1 parent d12f19e commit cc52fc2

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/utils/formatError.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ export function formatError(error) {
22
if (typeof error === 'string') return error;
33
if (error.request) {
44
// axios 错误
5-
return JSON.stringify(error.response.data);
5+
if(error.response)
6+
return JSON.stringify(error.response.data);
7+
else
8+
return JSON.stringify(error.request);
69
} else if (typeof error.message === 'object') {
710
// graphql 错误
811
if (error.message.message) {

tests/functions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ test('user:sendVerifyEmail 发送验证邮件', async t => {
353353
t.assert(res.status === true);
354354
});
355355

356-
test.only('user:checkLoginStatus 检查登录状态', async t => {
356+
test('user:checkLoginStatus 检查登录状态', async t => {
357357
const validAuth = auth;
358358
let email = randomEmail();
359359
let user = await validAuth.register({

0 commit comments

Comments
 (0)