mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-07-26 09:52:11 +03:00
Collapse duplicate CI spend while keeping each gate's existence reason: - quality.yml: TIA __RUN_ALL__ defers full unit to fast-unit 4-shard (#6781); path filters via classify-pr-changes; docs-gates split; draft skip - ci.yml: wire docs/i18n/code path filters; ESLint JSON artifact for quality-gate; drop advisory typecheck:noimplicit; float actions/cache@v6 - TIA parity: memory/usage/combo/serial; **/*.test.mjs any depth; electron/bin no longer force unit __RUN_ALL__ - check:complexity-ratchets: one ESLint walk, ruleId-isolated baselines + cache - check:api-docs-refs + lib/apiRoutes: shared API route inventory - husky pre-push: intentionally light (gates live in pre-commit); CLAUDE.md + QUALITY_GATES.md docs synced - collect-metrics / lint:json: path.resolve cache path; Windows-safe eslint bin - env-doc allowlist for ESLINT_RESULTS_JSON / COMPLEXITY_ESLINT_REPORT - release-green --full-ci expects check:api-docs-refs (not docs-symbols alone) Tests: select-impacted, classify-pr-changes, api-routes lib, complexity-rule-count, validate-release-green. Reconciled after #6781 (fast-unit 2→4 shards) per maintainer request on #6716. Co-authored-by: Diego Rodrigues de Sa e Souza <8016841+diegosouzapw@users.noreply.github.com>
34 lines
1.3 KiB
TypeScript
34 lines
1.3 KiB
TypeScript
/**
|
|
* Shared API route collector — locks path normalization used by openapi + docs gates.
|
|
*/
|
|
import test from "node:test";
|
|
import assert from "node:assert/strict";
|
|
import path from "node:path";
|
|
import {
|
|
collectApiRouteFiles,
|
|
collectApiRouteUrlPaths,
|
|
toApiUrlPath,
|
|
} from "../../scripts/check/lib/apiRoutes.mjs";
|
|
|
|
test("toApiUrlPath maps [id] and [...slug] to OpenAPI-style braces", () => {
|
|
const apiRoot = path.join("C:", "repo", "src", "app", "api");
|
|
assert.equal(
|
|
toApiUrlPath(path.join(apiRoot, "providers", "[id]", "models"), apiRoot).replace(/\\/g, "/"),
|
|
"/api/providers/{id}/models"
|
|
);
|
|
assert.equal(
|
|
toApiUrlPath(path.join(apiRoot, "files", "[...path]"), apiRoot).replace(/\\/g, "/"),
|
|
"/api/files/{path}"
|
|
);
|
|
});
|
|
|
|
test("live repo has route files and matching URL paths", () => {
|
|
const files = collectApiRouteFiles();
|
|
const urls = collectApiRouteUrlPaths();
|
|
assert.ok(files.size > 50, `expected many route files, got ${files.size}`);
|
|
assert.ok(urls.length > 50, `expected many url paths, got ${urls.length}`);
|
|
assert.equal(files.size, urls.length, "each route file should yield one URL path");
|
|
assert.ok([...files].every((f) => f.startsWith("src/app/api/") && /route\.tsx?$/.test(f)));
|
|
assert.ok(urls.every((u) => u.startsWith("/api")));
|
|
});
|