补齐审批退回结果通知 [09-04-approval-return-notification-gap]

这个提交包含在:
2026-09-04 16:22:27 +08:00
父节点 a6ffb7fc3c
当前提交 2e69fe4edb
共修改 19 个文件,包含 857 行新增和 14 行删除
@@ -1,3 +1,7 @@
const {
NOTIFICATION_DOMAIN_SCOPES,
NOTIFICATION_TYPES,
} = require("../../../src/constants/notificationTypes");
const {
isImChannelTypeSupported,
matchesNotificationChannel,
@@ -88,4 +92,37 @@ describe("IM routing", () => {
}),
).toBe(false);
});
it.each([
[NOTIFICATION_TYPES.leaveReturned, NOTIFICATION_DOMAIN_SCOPES.leave],
[NOTIFICATION_TYPES.purchaseRequestReturned, NOTIFICATION_DOMAIN_SCOPES.procurement],
[NOTIFICATION_TYPES.travelRequestReturned, NOTIFICATION_DOMAIN_SCOPES.travel],
])("requires both the allowed type and domain for %s", (notificationType, domainScope) => {
const buildChannel = (routing) => ({
enabled: true,
channel_type: "wecom",
config_json: { routing },
});
const context = {
notificationType,
domainScope,
recipientRoleCodes: ["employee"],
};
expect(matchesNotificationChannel(buildChannel({
roleCodes: [],
domainScopes: [domainScope],
allowedTypes: [notificationType],
}), context)).toBe(true);
expect(matchesNotificationChannel(buildChannel({
roleCodes: [],
domainScopes: [NOTIFICATION_DOMAIN_SCOPES.workflow],
allowedTypes: [notificationType],
}), context)).toBe(false);
expect(matchesNotificationChannel(buildChannel({
roleCodes: [],
domainScopes: [domainScope],
allowedTypes: [NOTIFICATION_TYPES.workflowTaskAssigned],
}), context)).toBe(false);
});
});