test(javascript): cover plain long-line loader identities (#1025)
This commit is contained in:
1 parent
0e25befe78
commit
984fc27ce1
1 file changed
+18
@@ -55,6 +55,24 @@ it.each([
|
||||
await expect(analyzeSource(source)).resolves.toBeDefined();
|
||||
});
|
||||
|
||||
it("analyzes a plain long-line loader without package metadata", async () => {
|
||||
const output = await analyzeSource(
|
||||
`var Module = {}; fetch(""); new Worker(""); var payload = "${"x".repeat(65_536)}";`,
|
||||
{ "game-data.js": "Module.data = { ready: true };" },
|
||||
);
|
||||
const nodes = output.graph.nodes.filter(
|
||||
({ kind }) => kind === "endpoint" || kind === "worker",
|
||||
);
|
||||
expect(nodes.map(({ kind }) => kind).sort()).toEqual(["endpoint", "worker"]);
|
||||
for (const node of nodes) {
|
||||
expect(node.identity).toMatchObject({
|
||||
strategy: "artifact-local-key",
|
||||
key: "",
|
||||
});
|
||||
expect(node.observations.map(({ label }) => label)).toEqual([null]);
|
||||
}
|
||||
});
|
||||
|
||||
it("keeps exact values for empty literals without synthetic application labels", async () => {
|
||||
const output = await analyzeSource(
|
||||
"fetch(''); fetch('\"\"'); fetch('/api'); process.on('', () => 1);",
|
||||
|
||||
Reference in new issue
Block a user