吸收数字员工管理端通知视图

This commit is contained in:
baiyanyun
2026-06-10 17:05:57 +08:00
parent 5b2f14123e
commit 1271e4967b
7 changed files with 234 additions and 46 deletions

View File

@@ -533,6 +533,68 @@ describe("digital employee sync service", () => {
status: "failed",
reason: "computer chat failed",
});
insertEventEntity("event-notification-read", "digital_workday_notification_read", {
metadata: {
notification_id: "task:task-1",
action: "read",
},
state: {
notificationStateById: {
"task:task-1": {
status: "read",
read_at: "2026-06-07T08:01:00.000Z",
},
},
},
});
insertEventEntity("event-notification-dismiss", "digital_workday_notification_dismiss", {
metadata: {
notification_id: "task:task-2",
action: "dismiss",
},
state: {
notificationStateById: {
"task:task-2": {
status: "dismissed",
dismissed_at: "2026-06-07T08:02:00.000Z",
},
},
},
});
insertEventEntity("event-notification-reply", "digital_workday_notification_reply", {
metadata: {
notification_id: "input:task-3",
action: "reply",
},
state: {
notificationStateById: {
"input:task-3": {
status: "read",
read_at: "2026-06-07T08:03:00.000Z",
reply: "请改用客户备用手机号",
replied_at: "2026-06-07T08:03:30.000Z",
},
},
},
});
insertEventEntity("event-notification-preferences", "digital_workday_update_notification_preferences", {
metadata: {
notification_preferences: {
enabled: false,
muted_kinds: ["task_finished", "need_input"],
muted_levels: ["info"],
updated_at: "2026-06-07T08:04:00.000Z",
},
},
state: {
notificationPreferences: {
enabled: false,
muted_kinds: ["task_finished", "need_input"],
muted_levels: ["info"],
updated_at: "2026-06-07T08:04:00.000Z",
},
},
});
mockState.fetch.mockResolvedValue(
jsonResponse({
success: true,
@@ -542,6 +604,10 @@ describe("digital employee sync service", () => {
{ entity_type: "event", entity_id: "event-artifact" },
{ entity_type: "event", entity_id: "event-skill" },
{ entity_type: "event", entity_id: "event-dispatch" },
{ entity_type: "event", entity_id: "event-notification-read" },
{ entity_type: "event", entity_id: "event-notification-dismiss" },
{ entity_type: "event", entity_id: "event-notification-reply" },
{ entity_type: "event", entity_id: "event-notification-preferences" },
],
}),
);
@@ -602,6 +668,36 @@ describe("digital employee sync service", () => {
status: "failed",
reason: "computer chat failed",
});
expect(businessView("event-notification-read")).toMatchObject({
category: "notification",
notification_id: "task:task-1",
action: "read",
status: "read",
read_at: "2026-06-07T08:01:00.000Z",
});
expect(businessView("event-notification-dismiss")).toMatchObject({
category: "notification",
notification_id: "task:task-2",
action: "dismiss",
status: "dismissed",
dismissed_at: "2026-06-07T08:02:00.000Z",
});
expect(businessView("event-notification-reply")).toMatchObject({
category: "notification",
notification_id: "input:task-3",
action: "reply",
status: "read",
read_at: "2026-06-07T08:03:00.000Z",
replied_at: "2026-06-07T08:03:30.000Z",
reply_length: 10,
});
expect(businessView("event-notification-reply")).not.toHaveProperty("reply");
expect(businessView("event-notification-preferences")).toMatchObject({
category: "notification",
preferences_enabled: false,
muted_kinds: ["task_finished", "need_input"],
muted_levels: ["info"],
});
expect(readEntity("event", "event-route")).toMatchObject({
sync_status: "synced",
sync_error: null,