沉淀数字员工角色偏好状态

This commit is contained in:
baiyanyun
2026-06-09 09:34:39 +08:00
parent 2f9af0b173
commit 726369f5a9
9 changed files with 216 additions and 32 deletions

View File

@@ -156,6 +156,50 @@ describe("digital employee state service", () => {
expect(mockState.ensureSchemaCalls).toBeGreaterThan(0);
});
it("persists console role and role preferences in UI state", async () => {
const { readDigitalEmployeeUiState, saveDigitalEmployeeUiState } = await import("./stateService");
saveDigitalEmployeeUiState({
action: "update_role_preferences",
metadata: { source: "ops-settings" },
state: {
selectedDutyIdsByDate: {},
confirmedDates: {},
reportScheduleTime: "17:30",
reportGeneratedAtByDate: {},
decisionResultsByDate: {},
consoleRole: "engineering",
rolePreferences: {
workStart: "10:00",
workEnd: "19:00",
notification: "system",
},
profile: {
name: "飞天数字员工",
company: "qimingclaw 客户端",
position: "客户端任务执行员",
currentStatus: "working",
},
},
});
expect(readDigitalEmployeeUiState()).toMatchObject({
reportScheduleTime: "17:30",
consoleRole: "engineering",
rolePreferences: {
workStart: "10:00",
workEnd: "19:00",
notification: "system",
},
});
const preferenceEvent = Array.from(mockState.db?.events.values() ?? [])
.find((event) => event.kind === "digital_workday_update_role_preferences");
expect(preferenceEvent).toMatchObject({
kind: "digital_workday_update_role_preferences",
message: "数字员工运营偏好已更新",
});
});
it("records governance commands as formal runtime records", async () => {
const { recordDigitalEmployeeGovernanceCommand } = await import("./stateService");