test(javascript): synchronize worker cleanup and validate candidate facts

This commit is contained in:
morluto
2026-10-14 12:21:22 +08:00
parent 7ad75bdc80
commit 5b5de1b527
2 changed files with 21 additions and 0 deletions
@@ -31,3 +31,19 @@ it("versions fingerprints through the worker schema and rejects v1", () => {
false,
);
});
it("accepts candidate endpoint interpretations from static analysis", () => {
const facts = analyzeJavaScriptStaticSource(`http.request("POST", target);`);
expect(facts.endpoints).toContainEqual(
expect.objectContaining({
kind: "network",
value: "POST",
interpretation: "candidate",
}),
);
expect(
javaScriptWorkerStaticAnalysisSchema.safeParse(
JSON.parse(JSON.stringify(facts)) as unknown,
).success,
).toBe(true);
});