mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-18 02:21:51 +08:00
feat(server): introduce user friendly server errors (#7111)
This commit is contained in:
@@ -66,7 +66,7 @@ test('should throw if email duplicated', async t => {
|
||||
const { auth } = t.context;
|
||||
|
||||
await t.throwsAsync(() => auth.signUp('u1', 'u1@affine.pro', '1'), {
|
||||
message: 'Email was taken',
|
||||
message: 'This email has already been registered.',
|
||||
});
|
||||
});
|
||||
|
||||
@@ -82,7 +82,7 @@ test('should throw if user not found', async t => {
|
||||
const { auth } = t.context;
|
||||
|
||||
await t.throwsAsync(() => auth.signIn('u2@affine.pro', '1'), {
|
||||
message: 'Invalid sign in credentials',
|
||||
message: 'Wrong user email or password.',
|
||||
});
|
||||
});
|
||||
|
||||
@@ -95,7 +95,8 @@ test('should throw if password not set', async t => {
|
||||
});
|
||||
|
||||
await t.throwsAsync(() => auth.signIn('u2@affine.pro', '1'), {
|
||||
message: 'User Password is not set. Should login through email link.',
|
||||
message:
|
||||
'You are trying to sign in by a different method than you signed up with.',
|
||||
});
|
||||
});
|
||||
|
||||
@@ -103,7 +104,7 @@ test('should throw if password not match', async t => {
|
||||
const { auth } = t.context;
|
||||
|
||||
await t.throwsAsync(() => auth.signIn('u1@affine.pro', '2'), {
|
||||
message: 'Invalid sign in credentials',
|
||||
message: 'Wrong user email or password.',
|
||||
});
|
||||
});
|
||||
|
||||
@@ -118,7 +119,7 @@ test('should be able to change password', async t => {
|
||||
await t.throwsAsync(
|
||||
() => auth.signIn('u1@affine.pro', '1' /* old password */),
|
||||
{
|
||||
message: 'Invalid sign in credentials',
|
||||
message: 'Wrong user email or password.',
|
||||
}
|
||||
);
|
||||
|
||||
@@ -135,7 +136,7 @@ test('should be able to change email', async t => {
|
||||
await auth.changeEmail(u1.id, 'u2@affine.pro');
|
||||
|
||||
await t.throwsAsync(() => auth.signIn('u1@affine.pro' /* old email */, '1'), {
|
||||
message: 'Invalid sign in credentials',
|
||||
message: 'Wrong user email or password.',
|
||||
});
|
||||
|
||||
signedInU1 = await auth.signIn('u2@affine.pro', '1');
|
||||
|
||||
Reference in New Issue
Block a user