forked from longtao.wu/droboticflow
26 lines
1.2 KiB
JavaScript
26 lines
1.2 KiB
JavaScript
import test from "node:test";
|
|
import assert from "node:assert/strict";
|
|
import fs from "node:fs";
|
|
|
|
const page = fs.readFileSync(new URL("../../src/pages/AnnotationOperations.tsx", import.meta.url), "utf8");
|
|
test("slice processing polls status without repeatedly requesting timelines or task histories", () => {
|
|
const polling = page.slice(
|
|
page.indexOf("const sliceGenerationFailed ="),
|
|
page.indexOf("const selectedTemplate = useMemo"),
|
|
);
|
|
assert.match(polling, /getTaskStatus/);
|
|
assert.doesNotMatch(polling, /getTask\(|loadFrameTimeline/);
|
|
assert.match(polling, /status.sliceStatus !== "processing" \|\| status.needsRefresh/);
|
|
assert.match(polling, /controller.abort\(\)/);
|
|
});
|
|
test("accepted async submission preserves the editor until authoritative completion", () => {
|
|
const submission = page.slice(
|
|
page.indexOf("const submitCombined = async"),
|
|
page.indexOf("const toggleSliceUsability"),
|
|
);
|
|
assert.match(submission, /submission.status === "processing"[\s\S]*?setCombinedSubmissionNotice[\s\S]*?return;/);
|
|
assert.match(submission, /getTaskStatus\(taskId\)/);
|
|
// Completion may continue to owned work or random claim; the browser journey
|
|
// verifies that transition instead of requiring a private return-to-pool call.
|
|
});
|