fix: remove XFT use-car submissions
This commit is contained in:
+20
-9
@@ -1243,27 +1243,38 @@ test("Xft preparation fails before confirmation when a selected code has no read
|
||||
);
|
||||
});
|
||||
|
||||
test("Xft use-car application is explicitly client-only and cannot be prepared", async () => {
|
||||
const template: XftSubmissionTemplate = {
|
||||
test("Xft use-car application is omitted and old signed references are rejected", async () => {
|
||||
const useCarTemplate: XftSubmissionTemplate = {
|
||||
eventSeqId: "event-car", eventNumber: "XFT-CAR", eventName: "用车申请单",
|
||||
eventType: "USE_CAR_APPLY", kind: "use_car_apply",
|
||||
};
|
||||
const expenseTemplate: XftSubmissionTemplate = {
|
||||
eventSeqId: "event-expense", eventNumber: "XFT-EXPENSE", eventName: "费用申请单",
|
||||
eventType: "EXPENSE_APPLY", kind: "expense_apply",
|
||||
};
|
||||
let schemaReads = 0;
|
||||
const xft = {
|
||||
async listSubmissionTemplates() { return [template]; },
|
||||
async listSubmissionTemplates() { return [useCarTemplate, expenseTemplate]; },
|
||||
async getSubmissionSchema() {
|
||||
return { template, fields: [], inputContract: { values: { standardFields: [] } }, diagnostics: {} };
|
||||
schemaReads += 1;
|
||||
return { template: useCarTemplate, fields: [], inputContract: { values: { standardFields: [] } }, diagnostics: {} };
|
||||
},
|
||||
};
|
||||
const service = new UnifiedApprovalService(config(), {} as ApprovalService, xft as never);
|
||||
const user = { userId: "user-1" };
|
||||
const templateId = String((await service.listSubmissionTemplates(user, "xft", 10)).items[0]?.templateId);
|
||||
const schema = await service.getSubmissionSchema(user, templateId);
|
||||
assert.equal(schema.submissionCapability.status, "client_only");
|
||||
assert.match(String(schema.submissionCapability.reason), /用车信息对象.*未提供可验证/);
|
||||
const listed = await service.listSubmissionTemplates(user, "xft", 10);
|
||||
assert.deepEqual(listed.items.map((item) => item.name), ["费用申请单"]);
|
||||
assert.equal(listed.sourceStatus.xft?.count, 1);
|
||||
const templateId = (service as any).signer.sign({
|
||||
kind: "submission_template", userId: user.userId, source: "xft",
|
||||
xftTemplate: useCarTemplate, exp: Date.now() + 60_000,
|
||||
});
|
||||
await assert.rejects(service.getSubmissionSchema(user, templateId), /不在 MCP 支持的发起范围/);
|
||||
await assert.rejects(
|
||||
service.prepareSubmission(user, { templateId, values: { useCarInfo: { purpose: "客户拜访" } } }),
|
||||
/用车申请.*薪福通客户端/,
|
||||
/不在 MCP 支持的发起范围/,
|
||||
);
|
||||
assert.equal(schemaReads, 0);
|
||||
});
|
||||
|
||||
test("Xft preparation reports standard and live custom required fields together", async () => {
|
||||
|
||||
@@ -790,7 +790,8 @@ test("Xft submission routes every supported template kind to its documented crea
|
||||
throw new Error(`unexpected ${path}`);
|
||||
});
|
||||
const templates = await client.listSubmissionTemplates({ userId: "ding-u1" }, 20);
|
||||
assert.equal(templates.length, 8);
|
||||
assert.equal(templates.length, 7);
|
||||
assert.equal(templates.some((item) => item.eventNumber === "T5"), false);
|
||||
assert.equal(templates.find((item) => item.eventNumber === "T8")?.kind, "expense_apply");
|
||||
for (const template of templates) await client.submitApproval({ userId: "ding-u1" }, template, {});
|
||||
assert.deepEqual(createPaths.sort(), [
|
||||
@@ -799,7 +800,6 @@ test("Xft submission routes every supported template kind to its documented crea
|
||||
"/itrip/xft-api/v1/bills/apply/expense/create",
|
||||
"/itrip/xft-api/v1/bills/apply/expense/create",
|
||||
"/itrip/xft-api/v1/bills/apply/travel/create",
|
||||
"/itrip/xft-api/v1/bills/apply/use-car/create",
|
||||
"/itrip/xft-api/v1/reimburse/bill/create",
|
||||
"/itrip/xft-api/v1/reimburse/bill/travel/create",
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user