test(housekeeping): finalize release evidence
This commit is contained in:
1 parent
222535e116
commit
4d0c8c7e65
1 file changed
+43
-7
+43
-7
@@ -234,24 +234,60 @@ describe("People production workflow adapter", () => {
|
||||
expect(mocks.transaction).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("checks every bulk target hierarchy before starting a mutation", async () => {
|
||||
it("assigns an existing configured rank above 7 for a super-admin", async () => {
|
||||
mocks.resolveServerContext.mockResolvedValue({
|
||||
...context(),
|
||||
actor: { id: 42, username: "operator", rank: 8 },
|
||||
isSuperAdmin: false,
|
||||
isSuperAdmin: true,
|
||||
});
|
||||
mocks.selectQueue.push([{ id: 7, rank: 8 }]);
|
||||
mocks.selectQueue.push([target({ rank: 2 })]);
|
||||
mocks.execute.mockResolvedValueOnce([[{ id: 9 }], []]);
|
||||
|
||||
const result = await peopleMutationService.execute(
|
||||
invocation,
|
||||
"users.bulk-ban",
|
||||
{ userIds: [7], duration: 3600, reason: "Denied" },
|
||||
"user.update",
|
||||
{ userId: 7, fields: { rank: 9 } },
|
||||
);
|
||||
|
||||
expect(result).toMatchObject({ ok: false, error: { code: "FORBIDDEN" } });
|
||||
expect(mocks.transaction).not.toHaveBeenCalled();
|
||||
expect(result).toMatchObject({ ok: true, data: { after: { rank: 9 } } });
|
||||
expect(mocks.updateSet).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ rank: 9 }),
|
||||
);
|
||||
expect(mocks.transaction).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it.each([
|
||||
["users.bulk-ban", { userIds: [7], duration: 3600, reason: "Denied" }],
|
||||
["users.bulk-unban", { userIds: [7] }],
|
||||
["users.bulk-currency", { userIds: [7], type: "credits", amount: 50 }],
|
||||
["users.bulk-badge", { userIds: [7], badgeCode: "ADM" }],
|
||||
] as const)(
|
||||
"checks target hierarchy before starting %s",
|
||||
async (operation, input) => {
|
||||
mocks.resolveServerContext.mockResolvedValue({
|
||||
...context(),
|
||||
actor: { id: 42, username: "operator", rank: 8 },
|
||||
isSuperAdmin: false,
|
||||
});
|
||||
mocks.selectQueue.push([{ id: 7, rank: 8 }]);
|
||||
|
||||
const result = await peopleMutationService.execute(
|
||||
invocation,
|
||||
operation,
|
||||
input,
|
||||
);
|
||||
|
||||
expect(result).toMatchObject({
|
||||
ok: false,
|
||||
error: { code: "FORBIDDEN" },
|
||||
});
|
||||
expect(mocks.transaction).not.toHaveBeenCalled();
|
||||
expect(mocks.insertValues).not.toHaveBeenCalled();
|
||||
expect(mocks.updateSet).not.toHaveBeenCalled();
|
||||
expect(mocks.deleteWhere).not.toHaveBeenCalled();
|
||||
},
|
||||
);
|
||||
|
||||
it("preserves legacy bulk order, duplicates, totals, and StaffActivities", async () => {
|
||||
const ids = Array.from({ length: 101 }, (_, index) => (index % 2) + 1);
|
||||
mocks.selectQueue.push([
|
||||
|
||||
Reference in new issue
Block a user