吸收数字员工审批历史订阅策略

This commit is contained in:
baiyanyun
2026-06-10 18:22:53 +08:00
parent 5b78189c9c
commit 3ac350eb27
12 changed files with 615 additions and 196 deletions

View File

@@ -511,6 +511,17 @@ describe("digital employee sync service", () => {
sla_summary: { due_at: "2026-06-08T09:00:00.000Z", sla_status: "tracked" },
risk_summary: { risk_level: "high" },
});
insertEventEntity("event-approval-decision", "approval_decision", {
approvalId: "approval-1",
decision: "approved",
previousStatus: "pending",
nextStatus: "approved",
actor: "operator",
decidedAt: "2026-06-07T08:05:00.000Z",
planId: "plan-1",
taskId: "task-1",
runId: "run-1",
});
insertEventEntity("event-artifact", "artifact_retention_marked", {
artifact_id: "artifact-1",
action: "mark_keep",
@@ -616,12 +627,34 @@ describe("digital employee sync service", () => {
},
},
});
insertEventEntity("event-approval-subscriptions", "digital_workday_update_approval_subscriptions", {
metadata: {
action: "update_approval_subscriptions",
approval_subscriptions: {
enabled: false,
subscribed_actions: ["mark_risk", "decision"],
subscribed_risk_levels: ["high", "critical"],
notify_on_timeout: false,
updated_at: "2026-06-07T08:06:00.000Z",
},
},
state: {
approvalSubscriptionPreferences: {
enabled: false,
subscribed_actions: ["mark_risk", "decision"],
subscribed_risk_levels: ["high", "critical"],
notify_on_timeout: false,
updated_at: "2026-06-07T08:06:00.000Z",
},
},
});
mockState.fetch.mockResolvedValue(
jsonResponse({
success: true,
acked: [
{ entity_type: "event", entity_id: "event-route" },
{ entity_type: "event", entity_id: "event-approval" },
{ entity_type: "event", entity_id: "event-approval-decision" },
{ entity_type: "event", entity_id: "event-artifact" },
{ entity_type: "event", entity_id: "event-skill" },
{ entity_type: "event", entity_id: "event-dispatch" },
@@ -630,6 +663,7 @@ describe("digital employee sync service", () => {
{ entity_type: "event", entity_id: "event-notification-dismiss" },
{ entity_type: "event", entity_id: "event-notification-reply" },
{ entity_type: "event", entity_id: "event-notification-preferences" },
{ entity_type: "event", entity_id: "event-approval-subscriptions" },
],
}),
);
@@ -665,6 +699,21 @@ describe("digital employee sync service", () => {
delegate_to: "manager-1",
comment_length: 4,
});
expect(businessView("event-approval")).not.toHaveProperty("comment");
expect(businessView("event-approval")).not.toHaveProperty("comment_preview");
expect(businessView("event-approval-decision")).toMatchObject({
category: "approval",
approval_id: "approval-1",
action: "decision",
decision: "approved",
previous_status: "pending",
next_status: "approved",
actor: "operator",
decided_at: "2026-06-07T08:05:00.000Z",
plan_id: "plan-1",
task_id: "task-1",
run_id: "run-1",
});
expect(businessView("event-artifact")).toMatchObject({
category: "artifact",
artifact_id: "artifact-1",
@@ -730,6 +779,17 @@ describe("digital employee sync service", () => {
muted_kinds: ["task_finished", "need_input"],
muted_levels: ["info"],
});
expect(businessView("event-approval-subscriptions")).toMatchObject({
category: "approval",
action: "update_approval_subscriptions",
preferences_enabled: false,
subscribed_actions: ["mark_risk", "decision"],
subscribed_risk_levels: ["high", "critical"],
notify_on_timeout: false,
updated_at: "2026-06-07T08:06:00.000Z",
});
expect(businessView("event-approval-subscriptions")).not.toHaveProperty("state");
expect(businessView("event-approval-subscriptions")).not.toHaveProperty("approvalSubscriptionPreferences");
expect(readEntity("event", "event-route")).toMatchObject({
sync_status: "synced",
sync_error: null,