OAPERM1 收紧启用前权限冻结
这个提交包含在:
@@ -143,7 +143,7 @@ async function buildApp({ permissionCodes = ["system.users"], stats } = {}) {
|
||||
}
|
||||
|
||||
describe("employees stats route", () => {
|
||||
it("returns aggregated employee stats for read-only viewers without salary data", async () => {
|
||||
it("returns aggregated employee stats for read-only viewers without salary or performance data", async () => {
|
||||
const {
|
||||
app,
|
||||
employeeGroupBy,
|
||||
@@ -182,27 +182,10 @@ describe("employees stats route", () => {
|
||||
expiringSoonCount: 4,
|
||||
});
|
||||
expect(payload.data.performanceSummary).toEqual({
|
||||
cycle: {
|
||||
id: "cycle-active",
|
||||
name: "2026 Q2",
|
||||
cycleType: "quarterly",
|
||||
status: "active",
|
||||
startDate: "2026-04-01",
|
||||
endDate: "2026-06-30",
|
||||
},
|
||||
averageScore: 4.2,
|
||||
reviewedCount: 5,
|
||||
distribution: [
|
||||
{ score: 1, count: 0 },
|
||||
{ score: 1.5, count: 0 },
|
||||
{ score: 2, count: 0 },
|
||||
{ score: 2.5, count: 0 },
|
||||
{ score: 3, count: 0 },
|
||||
{ score: 3.5, count: 0 },
|
||||
{ score: 4, count: 3 },
|
||||
{ score: 4.5, count: 2 },
|
||||
{ score: 5, count: 0 },
|
||||
],
|
||||
cycle: null,
|
||||
averageScore: null,
|
||||
reviewedCount: 0,
|
||||
distribution: [],
|
||||
});
|
||||
expect(payload.data.salarySummary).toBeNull();
|
||||
expect(employeeGroupBy).toHaveBeenCalledTimes(2);
|
||||
@@ -211,17 +194,17 @@ describe("employees stats route", () => {
|
||||
expect(contractCount).toHaveBeenCalledTimes(1);
|
||||
expect(certificateGroupBy).toHaveBeenCalledTimes(1);
|
||||
expect(certificateCount).toHaveBeenCalledTimes(1);
|
||||
expect(performanceCycleFindFirst).toHaveBeenCalledTimes(2);
|
||||
expect(performanceReviewAggregate).toHaveBeenCalledTimes(1);
|
||||
expect(performanceReviewGroupBy).toHaveBeenCalledTimes(1);
|
||||
expect(performanceCycleFindFirst).not.toHaveBeenCalled();
|
||||
expect(performanceReviewAggregate).not.toHaveBeenCalled();
|
||||
expect(performanceReviewGroupBy).not.toHaveBeenCalled();
|
||||
expect(payslipAggregate).not.toHaveBeenCalled();
|
||||
|
||||
await app.close();
|
||||
});
|
||||
|
||||
it("returns salary summary for system.users viewers", async () => {
|
||||
it("returns salary and performance summary for system settings viewers", async () => {
|
||||
const { app, payslipAggregate } = await buildApp({
|
||||
permissionCodes: ["system.users"],
|
||||
permissionCodes: ["system.users", "system.settings"],
|
||||
});
|
||||
|
||||
const response = await app.inject({
|
||||
@@ -244,6 +227,10 @@ describe("employees stats route", () => {
|
||||
issuedCount: 2,
|
||||
},
|
||||
});
|
||||
expect(response.json().data.performanceSummary.cycle).toMatchObject({
|
||||
id: "cycle-active",
|
||||
name: "2026 Q2",
|
||||
});
|
||||
expect(payslipAggregate).toHaveBeenCalledTimes(2);
|
||||
|
||||
await app.close();
|
||||
|
||||
在新工单中引用
屏蔽一个用户