43 行
1.9 KiB
JavaScript
43 行
1.9 KiB
JavaScript
import assert from "node:assert/strict"
|
|
import { readFile } from "node:fs/promises"
|
|
import test from "node:test"
|
|
|
|
const appPath = new URL("../standalone-web/src/App.vue", import.meta.url)
|
|
const dialogPath = new URL(
|
|
"../standalone-web/src/features/workflow/WorkflowGenerationReviewDialog.vue",
|
|
import.meta.url,
|
|
)
|
|
const endpointsPath = new URL("../shared/api/endpoints.ts", import.meta.url)
|
|
|
|
test("wires the single generation cross-review dialog to all three backend operations", async () => {
|
|
const [app, dialog, endpoints] = await Promise.all([
|
|
readFile(appPath, "utf8"),
|
|
readFile(dialogPath, "utf8"),
|
|
readFile(endpointsPath, "utf8"),
|
|
])
|
|
|
|
assert.equal((app.match(/<WorkflowGenerationReviewDialog\b/g) ?? []).length, 1)
|
|
assert.match(app, /endpoints\.roundGenerationCrossReview\(/)
|
|
assert.match(app, /endpoints\.roundGenerationCrossReviewRegenerate\(/)
|
|
assert.match(app, /endpoints\.roundGenerationCrossReviewApprove\(/)
|
|
assert.match(app, /required_action/)
|
|
assert.match(app, /restoration_node_id/)
|
|
assert.match(app, /loadWorkflowRounds\(result\.round\.node_id, true\)/)
|
|
|
|
assert.match(dialog, /model_routes: \[\.\.\.reviewModelRoutes\.value\]/)
|
|
assert.match(dialog, /candidate_ids: \[\.\.\.regenerationCandidateIds\.value\]/)
|
|
assert.match(dialog, /decisionCandidateId\.value = ""/)
|
|
assert.match(dialog, /approvalCandidateId\.value = ""/)
|
|
assert.match(dialog, /createSafeBackdropClose/)
|
|
assert.match(dialog, /readOnly/)
|
|
|
|
assert.match(endpoints, /roundGenerationCrossReview:/)
|
|
assert.match(endpoints, /roundGenerationCrossReviewRegenerate:/)
|
|
assert.match(endpoints, /roundGenerationCrossReviewApprove:/)
|
|
})
|
|
|
|
test("never silently selects the first cross-review candidate", async () => {
|
|
const dialog = await readFile(dialogPath, "utf8")
|
|
assert.doesNotMatch(dialog, /decisionCandidateId\.value\s*=\s*[^\n]*candidates\s*\[\s*0\s*\]/)
|
|
assert.doesNotMatch(dialog, /approvalCandidateId\.value\s*=\s*[^\n]*candidates\s*\[\s*0\s*\]/)
|
|
})
|