mirror of
https://github.com/bytedance/deer-flow.git
synced 2026-04-25 11:18:22 +00:00
* feat: set up Vitest frontend testing infrastructure with CI workflow Migrate existing 4 frontend test files from Node.js native test runner (node:test + node:assert/strict) to Vitest, reorganize test directory structure under tests/unit/ mirroring src/ layout, and add a dedicated CI workflow for frontend unit tests. - Add vitest as devDependency, remove tsx - Create vitest.config.ts with @/ path alias - Migrate tests to Vitest API (test/expect/vi) - Rename .mjs test files to .ts - Move tests from src/ to tests/unit/ (mirrors src/ layout) - Add frontend/Makefile `test` target - Add .github/workflows/frontend-unit-tests.yml (parallel to backend) - Update CONTRIBUTING.md, README.md, AGENTS.md, CLAUDE.md Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * style: fix the lint error * style: fix the lint error --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Willem Jiang <willem.jiang@gmail.com>
41 lines
865 B
TypeScript
41 lines
865 B
TypeScript
import { expect, test } from "vitest";
|
|
|
|
import { sanitizeRunStreamOptions } from "@/core/api/stream-mode";
|
|
|
|
test("drops unsupported stream modes from array payloads", () => {
|
|
const sanitized = sanitizeRunStreamOptions({
|
|
streamMode: [
|
|
"values",
|
|
"messages-tuple",
|
|
"custom",
|
|
"updates",
|
|
"events",
|
|
"tools",
|
|
],
|
|
});
|
|
|
|
expect(sanitized.streamMode).toEqual([
|
|
"values",
|
|
"messages-tuple",
|
|
"custom",
|
|
"updates",
|
|
"events",
|
|
]);
|
|
});
|
|
|
|
test("drops unsupported stream modes from scalar payloads", () => {
|
|
const sanitized = sanitizeRunStreamOptions({
|
|
streamMode: "tools",
|
|
});
|
|
|
|
expect(sanitized.streamMode).toBeUndefined();
|
|
});
|
|
|
|
test("keeps payloads without streamMode untouched", () => {
|
|
const options = {
|
|
streamSubgraphs: true,
|
|
};
|
|
|
|
expect(sanitizeRunStreamOptions(options)).toBe(options);
|
|
});
|