fix(javascript): retain endpoint candidates through graph projection

This commit is contained in:
morluto
2026-10-14 09:47:30 +08:00
parent 6e344302cb
commit 88afcc738b
9 changed files with 226 additions and 27 deletions
@@ -0,0 +1,32 @@
import { expect, it } from "vitest";
import { analyzeJavaScriptStaticSource } from "./javascriptStaticAnalysis.js";
it("reads exact route-property templates and leaves interpolated values unknown", () => {
const analysis = analyzeJavaScriptStaticSource(`
const routes = [
{ path: \`settings\` },
{ route: \`users/\${userId}\` },
{ path: "/login" },
];
`);
expect(
analysis.endpoints.map(({ value, mechanism, interpretation }) => ({
value,
mechanism,
interpretation,
})),
).toEqual([
{
value: "settings",
mechanism: "property:path",
interpretation: undefined,
},
{
value: "/login",
mechanism: "property:path",
interpretation: undefined,
},
]);
});