Release v2.20.1: migrate authentication to Better Auth
This commit is contained in:
1 parent
e9a53f577c
commit
fba4f99ff7
92 files changed
+5085
-1943
No files matched your search
@@ -15,6 +15,7 @@ test('user create route allows users without roles', async () => {
|
||||
};
|
||||
|
||||
let insertedArgs = null;
|
||||
let credentialPassword = null;
|
||||
let syncedRoles = null;
|
||||
|
||||
const deps = {
|
||||
@@ -33,6 +34,13 @@ test('user create route allows users without roles', async () => {
|
||||
insertedArgs = args;
|
||||
return [{ insertId: 11 }];
|
||||
}
|
||||
if (sql.includes('SELECT id, created_at, modified_at FROM a_users')) {
|
||||
return [[{ id: 11, created_at: new Date(), modified_at: new Date() }]];
|
||||
}
|
||||
if (sql.includes('INSERT INTO a_accounts')) {
|
||||
credentialPassword = args[3];
|
||||
return [{ affectedRows: 1 }];
|
||||
}
|
||||
return [[]];
|
||||
},
|
||||
async commit() {},
|
||||
@@ -81,7 +89,8 @@ test('user create route allows users without roles', async () => {
|
||||
name: 'No Roles User',
|
||||
username: 'noroles',
|
||||
password: 'ValidPass!1',
|
||||
confirm_password: 'ValidPass!1'
|
||||
confirm_password: 'ValidPass!1',
|
||||
must_change_password: '1'
|
||||
},
|
||||
currentUser: { id: 1 }
|
||||
};
|
||||
@@ -100,6 +109,8 @@ test('user create route allows users without roles', async () => {
|
||||
await routeHandlers[1](req, res, () => {});
|
||||
|
||||
assert.ok(insertedArgs);
|
||||
assert.equal(insertedArgs[3], 1);
|
||||
assert.match(credentialPassword, /^[a-f0-9]{32}:[a-f0-9]{128}$/);
|
||||
assert.deepEqual(syncedRoles, { userId: 11, roleIds: [] });
|
||||
assert.equal(res.redirectedTo, '/settings/users/11/edit?message=User%20created.');
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user