补齐审批退回结果通知 [09-04-approval-return-notification-gap]
这个提交包含在:
@@ -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);
|
||||
});
|
||||
});
|
||||
|
||||
在新工单中引用
屏蔽一个用户