feat: 增加多品牌切换并继续拆分控制器
This commit is contained in:
1 parent
f4a93bba23
commit
045472035b
7 files changed
+126
-3
No files matched your search
@@ -769,6 +769,25 @@ test("admin login validates credentials", async () => {
|
||||
assert.equal(response.statusCode, 401);
|
||||
});
|
||||
|
||||
test("admin can list and switch only enabled brand memberships", async () => {
|
||||
const login = await request("/admin/session/login", {
|
||||
method: "POST",
|
||||
payload: { username: "admin", password: process.env.SEED_ADMIN_PASSWORD },
|
||||
});
|
||||
const token = JSON.parse(login.body).token;
|
||||
const brands = await request("/admin/brands", {
|
||||
headers: { authorization: `Bearer ${token}` },
|
||||
});
|
||||
assert.equal(brands.statusCode, 200);
|
||||
const memberships = JSON.parse(brands.body);
|
||||
assert.ok(memberships.some((item) => item.brand.id === brandId));
|
||||
const denied = await request("/admin/brands/00000000-0000-0000-0000-000000000000/switch", {
|
||||
method: "POST",
|
||||
headers: { authorization: `Bearer ${token}` },
|
||||
});
|
||||
assert.equal(denied.statusCode, 403);
|
||||
});
|
||||
|
||||
test("disabled brand membership blocks existing admin token", async () => {
|
||||
const login = await request("/admin/session/login", {
|
||||
method: "POST",
|
||||
|
||||
Reference in new issue
Block a user