50 lines
1.9 KiB
JavaScript
50 lines
1.9 KiB
JavaScript
import test from "node:test";
|
|
import assert from "node:assert/strict";
|
|
import { readFile } from "node:fs/promises";
|
|
|
|
const pageURL = new URL("../../src/pages/DataOperations.tsx", import.meta.url);
|
|
const serviceURL = new URL("../../src/services/api/data-operations.ts", import.meta.url);
|
|
|
|
test("data operations page exposes complete task and business metric surfaces", async () => {
|
|
const source = await readFile(pageURL, "utf8");
|
|
|
|
assert.match(source, /数据总览/);
|
|
assert.match(source, /完整任务/);
|
|
assert.match(source, /数据版本/);
|
|
assert.match(source, /训练使用/);
|
|
assert.match(source, /技术有效/);
|
|
assert.match(source, /训练可用/);
|
|
assert.match(source, /训练消费/);
|
|
});
|
|
|
|
test("data task creation is product-generic instead of a hard-coded pilot", async () => {
|
|
const source = await readFile(pageURL, "utf8");
|
|
|
|
assert.doesNotMatch(source, /\bY1\b/);
|
|
assert.match(source, /name: ""/);
|
|
assert.match(source, /robotModel: ""/);
|
|
assert.match(source, /scene: ""/);
|
|
assert.match(source, /modalities: \[\]/);
|
|
assert.match(source, /targets: \{\}/);
|
|
assert.match(source, />\s*新建数据任务\s*</);
|
|
});
|
|
|
|
test("data operations polling pauses while the page is hidden", async () => {
|
|
const source = await readFile(pageURL, "utf8");
|
|
|
|
assert.match(source, /document\.hidden/);
|
|
assert.match(source, /visibilitychange/);
|
|
assert.match(source, /30_000/);
|
|
assert.match(source, /controller\?\.abort\(\)/);
|
|
});
|
|
|
|
test("data operations client uses additive compatibility endpoints", async () => {
|
|
const source = await readFile(serviceURL, "utf8");
|
|
|
|
assert.match(source, /\/api\/data-collection-tasks/);
|
|
assert.match(source, /\/api\/data-operations\/summary/);
|
|
assert.match(source, /\/api\/data-operations\/stage-items/);
|
|
assert.match(source, /\/api\/data-operations\/training-usage/);
|
|
assert.match(source, /\/api\/data-operations\/datasets/);
|
|
});
|