- Separate B2B_SUPPLIER_STRATEGY strategic manager actions from digital tasks - Ensure strategic proposals do not create/requeue digital tasks or set executedAt - Ensure SEO and digital approvals transition actionable tasks to TODO - Strengthen task completion policy: require independently verifiable HTTP(S) deliverables, reject canina://, git://stage, and post-tsk missing article placeholders - Reject completion when QA verification evidence reports 404 or missing article errors - Add unit test coverage for ApprovalsController, DepartmentTasksController and completion policy
85 lines
2.8 KiB
TypeScript
85 lines
2.8 KiB
TypeScript
import { BadRequestException } from "@nestjs/common";
|
|
import { assertTaskCanComplete } from "./department-task-completion.policy";
|
|
|
|
describe("department task completion policy", () => {
|
|
it("rejects model-only output without a live deliverable", () => {
|
|
expect(() =>
|
|
assertTaskCanComplete({
|
|
deliverableUrl: null,
|
|
acceptanceCriteria: { criteria: ["live URL responds 200"] },
|
|
executionLogs: [{ status: "COMPLETED_BY_AGENT" }],
|
|
}),
|
|
).toThrow(BadRequestException);
|
|
});
|
|
|
|
it("rejects completion without acceptance criteria", () => {
|
|
expect(() =>
|
|
assertTaskCanComplete({
|
|
deliverableUrl: "https://canina.ir/blog/verified",
|
|
acceptanceCriteria: null,
|
|
executionLogs: [{ status: "QA_PASSED" }],
|
|
}),
|
|
).toThrow(BadRequestException);
|
|
});
|
|
|
|
it("rejects completion without QA evidence", () => {
|
|
expect(() =>
|
|
assertTaskCanComplete({
|
|
deliverableUrl: "https://canina.ir/blog/verified",
|
|
acceptanceCriteria: { criteria: ["HTTP 200"] },
|
|
executionLogs: [{ status: "COMPLETED_BY_AGENT" }],
|
|
}),
|
|
).toThrow(BadRequestException);
|
|
});
|
|
|
|
it("allows completion with URL, criteria and QA evidence", () => {
|
|
expect(() =>
|
|
assertTaskCanComplete({
|
|
deliverableUrl: "https://canina.ir/blog/verified",
|
|
acceptanceCriteria: { criteria: ["HTTP 200"] },
|
|
executionLogs: [{ status: "QA_PASSED" }],
|
|
}),
|
|
).not.toThrow();
|
|
});
|
|
|
|
it("rejects pseudo-protocol canina:// deliverable URLs", () => {
|
|
expect(() =>
|
|
assertTaskCanComplete({
|
|
deliverableUrl: "canina://blog/sample-article",
|
|
acceptanceCriteria: { criteria: ["HTTP 200"] },
|
|
executionLogs: [{ status: "QA_PASSED" }],
|
|
}),
|
|
).toThrow(BadRequestException);
|
|
});
|
|
|
|
it("rejects git://stage staging or repo URLs as verifiable deliverable", () => {
|
|
expect(() =>
|
|
assertTaskCanComplete({
|
|
deliverableUrl: "git://stage/canina-repo#commit123",
|
|
acceptanceCriteria: { criteria: ["HTTP 200"] },
|
|
executionLogs: [{ status: "QA_PASSED" }],
|
|
}),
|
|
).toThrow(BadRequestException);
|
|
});
|
|
|
|
it("rejects missing or placeholder post-tsk article deliverables", () => {
|
|
expect(() =>
|
|
assertTaskCanComplete({
|
|
deliverableUrl: "https://canina.ir/blog/post-tsk-49102",
|
|
acceptanceCriteria: { criteria: ["HTTP 200"] },
|
|
executionLogs: [{ status: "QA_PASSED" }],
|
|
}),
|
|
).toThrow(BadRequestException);
|
|
});
|
|
|
|
it("rejects completion when QA evidence reports missing article or 404 error", () => {
|
|
expect(() =>
|
|
assertTaskCanComplete({
|
|
deliverableUrl: "https://canina.ir/blog/verified-article",
|
|
acceptanceCriteria: { criteria: ["HTTP 200"] },
|
|
executionLogs: [{ status: "QA_PASSED", note: "HTTP 404 - مقاله یافت نشد" }],
|
|
}),
|
|
).toThrow(BadRequestException);
|
|
});
|
|
});
|