feat: optimize user management and add account deletion
This commit is contained in:
@@ -23,6 +23,23 @@ test("builds the KOC LOOP product shell", async () => {
|
||||
await access(new URL("../dist/client/assets", import.meta.url));
|
||||
});
|
||||
|
||||
test("stacks user management and securely removes departed accounts", async () => {
|
||||
const [usersPage, usersRoute, globalCss] = await Promise.all([
|
||||
readFile(new URL("../app/users-page.tsx", import.meta.url), "utf8"),
|
||||
readFile(new URL("../app/api/users/route.ts", import.meta.url), "utf8"),
|
||||
readFile(new URL("../app/globals.css", import.meta.url), "utf8"),
|
||||
]);
|
||||
|
||||
assert.match(globalCss, /\.user-management-layout\s*\{[^}]*grid-template-columns:\s*1fr/s);
|
||||
assert.match(usersPage, /删除账号/);
|
||||
assert.match(usersPage, /role="alertdialog"/);
|
||||
assert.match(usersRoute, /body\.action === "delete"/);
|
||||
assert.match(usersRoute, /不能删除当前登录账号/);
|
||||
assert.match(usersRoute, /不能删除超级管理员账号/);
|
||||
assert.match(usersRoute, /DELETE FROM auth_sessions WHERE user_id = \?/);
|
||||
assert.match(usersRoute, /DELETE FROM users WHERE id = \? AND role <> 'super_admin'/);
|
||||
});
|
||||
|
||||
test("ships persistence, uploads, metadata, and no starter preview", async () => {
|
||||
const [adminApp, layout, packageJson, hosting] = await Promise.all([
|
||||
readFile(new URL("../app/admin-app.tsx", import.meta.url), "utf8"),
|
||||
|
||||
Reference in New Issue
Block a user