fix: 区分 MDTODO source 与 target freshness
This commit is contained in:
@@ -22,9 +22,11 @@ describe("MDTODO safe title stdin adoption", () => {
|
||||
const temporary = mkdtempSync("/tmp/unidesk-mdtodo-safe-input-");
|
||||
try {
|
||||
const source = join(temporary, "source");
|
||||
const staleSource = join(temporary, "stale-source");
|
||||
const staleTarget = join(temporary, "stale-target");
|
||||
const readyTarget = join(temporary, "ready-target");
|
||||
writeFixture(source, true);
|
||||
writeFixture(staleSource, false);
|
||||
writeFixture(staleTarget, false);
|
||||
writeFixture(readyTarget, true);
|
||||
|
||||
@@ -41,6 +43,14 @@ describe("MDTODO safe title stdin adoption", () => {
|
||||
freshness: "ready",
|
||||
warning: null,
|
||||
});
|
||||
expect(collectMdtodoSafeTitleStdinCapability(staleSource, readyTarget)).toMatchObject({
|
||||
nonBlocking: true,
|
||||
ready: true,
|
||||
freshness: "source-stale",
|
||||
source: { ready: false },
|
||||
target: { ready: true },
|
||||
warning: expect.stringContaining("approved source"),
|
||||
});
|
||||
} finally {
|
||||
rmSync(temporary, { recursive: true, force: true });
|
||||
}
|
||||
|
||||
@@ -364,7 +364,7 @@ function probeMdtodoSafeTitleStdin(skillsPath: string): MdtodoSafeTitleStdinProb
|
||||
export function collectMdtodoSafeTitleStdinCapability(sourcePath: string, targetPath: string): MdtodoSafeTitleStdinCapability {
|
||||
const source = probeMdtodoSafeTitleStdin(sourcePath);
|
||||
const target = probeMdtodoSafeTitleStdin(targetPath);
|
||||
const freshness = target.ready
|
||||
const freshness = source.ready && target.ready
|
||||
? "ready"
|
||||
: source.ready
|
||||
? "target-stale"
|
||||
|
||||
Reference in New Issue
Block a user