21 lines
1.4 KiB
JavaScript
21 lines
1.4 KiB
JavaScript
import assert from "node:assert/strict";
|
|
import { readFileSync } from "node:fs";
|
|
import path from "node:path";
|
|
|
|
const root = process.cwd();
|
|
const source = readFileSync(path.join(root, "src/views/OperationReportView.vue"), "utf8");
|
|
|
|
assert.match(source, /syncReportsToErp/, "operation report page should define an explicit ERP sync action");
|
|
assert.match(source, /loadSyncState/, "operation report page should load sync state on entry");
|
|
assert.match(source, /fetchResource\("\/production\/miniapp-operation-reports\/sync-state"/, "page should read the last successful sync time");
|
|
assert.match(source, /postResource\("\/production\/miniapp-operation-reports\/sync"/, "sync action should call the dedicated sync endpoint");
|
|
assert.match(source, /syncingReports\.value\s*=\s*true/, "sync action should enable loading state");
|
|
assert.match(source, /:disabled="syncingReports"/, "sync button should be disabled while syncing");
|
|
assert.match(source, /同步中/, "sync button should show a syncing label");
|
|
assert.match(source, /lastSyncedAt/, "page should display the last successful sync time");
|
|
assert.match(source, /await loadReports\(\)/, "page should refresh the list after sync succeeds");
|
|
assert.doesNotMatch(source, /sync_to_erp:\s*"true"/, "list refresh should not sync ERP implicitly");
|
|
assert.match(source, /sync_to_erp:\s*"false"/, "list refresh should explicitly request read-only data");
|
|
|
|
console.log("operation report sync checks passed");
|