TelosDB / tests /
@楽曲作りまくりおじさん 楽曲作りまくりおじさん authored 1 day ago
..
e2e fix(db): skip path normalize migration when documents table missing; rules, archive, check-mermaid, both dist builds 1 day ago
unit fix(db): skip path normalize migration when documents table missing; rules, archive, check-mermaid, both dist builds 1 day ago
README.md v0.3.2: 取得件数既定5件、フッターv?・バージョン一致テスト、E2E統合・配布前ルール、ジャーナル014 1 day ago
test_mcp_client.mjs fix(db): skip path normalize migration when documents table missing; rules, archive, check-mermaid, both dist builds 1 day ago
README.md

テスト一覧

方針: テストは原則ルート直下の tests/ に集約する。

配布ビルド前のルール: build:community / build:pro を実行する前に、npm run test:all(Community・Pro の単体+E2E の 4 本)を実行し、すべて成功していること。詳細は docs/specification/05_development_guide.md.agent/rules/distribution-build.md

  • 単体: Rust はソース内 #[cfg(test)](実行は npm run test:rust でルートから実行)。
  • 結合: Node は tests/test_mcp_client.mjs。Rust の結合テストファイルだけは Cargo の仕様で src/backend/tests/ に配置(Cargo はクレート直下の tests/ しか結合テストとして認識しない)。実行はルートから npm run test:integration:rust で呼び出す。
  • E2E: tests/e2e/

単体・結合・E2E の 3 層を用意している。

種別 内容 場所 実行方法
単体 Rust のモジュール単位テスト(DB・LSA・MCP・埋め込み・トークナイザ等) src/backend/src/**/*.rs 内の #[cfg(test)] mod tests npm run test:rustcargo test
結合 MCP API を実際に叩くテスト(tools/list, /version, search_text, CRUD 一連, lsa_retrain 等)。/version が package.json の version と一致することを検証 Node: tests/test_mcp_client.mjs
Rust: src/backend/tests/search_api.rs#[ignore] 付き)
Node: npm run test:mcp / test-and-heal 等(MCP 起動前提)
Rust: npm run test:integration:rust(MCP 起動前提)
E2E アプリ全体を WebDriver で操作して UI を検証(タイトル・ヘッダー・検索・パネル・編集モーダル等)。フッター表示バージョンが package.json と一致することを検証 tests/e2e/specs/*.spec.js(app, panels, docs-edit-drawing, screenshot-docs-modal) npm run test:e2e(Community ビルド)
npm run test:e2e:pro(Pro ビルド。embedding モデル要)

Pro 版のテスト

種別 実行方法 備考
単体 npm run test:rust:pro --no-default-features --features pro で埋め込み・Pro 用コードを含めて cargo test
結合 npm run test:mcp:pro / npm run test-and-heal:pro Pro アプリを起動してから test_mcp_client.mjs(Pro 時スコア・vector_search_used 等を検証)
E2E npm run test:e2e:pro 事前に build:e2e:pro(embedding モデル必須)を実行し、Pro バイナリで同じ E2E スペックを実行

単体テスト(Unit)

  • 実行: npm run test:rust(Community)/ npm run test:rust:pro(Pro)
  • 中身: src/backend 内の各モジュールに #[cfg(test)] mod tests で定義。DB 初期化・次元変更、LSA 分散・チャンク分割、MCP チャンク分割ロジック、埋め込み・トークナイザ・dev_static・registry(tool_list のツール数・名前)などのユニットテスト。
  • 前提: vec0.dll 等のネイティブ依存があるテストは、未配置時はスキップされる場合あり。

結合テスト(Integration)

  • Node(test_mcp_client.mjs): MCP が 127.0.0.1:3001 で起動している前提。tools/listsearch_text・Pro 時のスコア検証など。npm run test-and-healtest-and-heal:pro で MCP を立ち上げてからこのスクリプトを実行する流れ。
  • Rust(search_api.rs): 同上、MCP 起動前提。ファイルは Cargo の都合で src/backend/tests/search_api.rs に配置。実行はルートから npm run test:integration:rust(MCP 起動前提)。通常の cargo test では #[ignore] によりスキップされる。

E2E テスト

  • 実行: npm run test:e2e(Community。onPrepare で build:e2e が走る)/ npm run test:e2e:pro(Pro。build:e2e:pro のあと wdio。embedding モデル要)
  • 詳細: tests/e2e/README.md を参照(tauri-driver・Edge Driver の準備など)。