From 984fc27ce19d57f708bdae688a258cf8663cdea6 Mon Sep 17 00:00:00 2001 From: Ysopwnable <161784452+N0zoM1z0@users.noreply.github.com> Date: Thu, 8 Oct 2026 03:56:10 +0800 Subject: [PATCH] test(javascript): cover plain long-line loader identities (#1025) --- .../JavaScriptApplicationEmptyLiterals.test.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/application/javascript/JavaScriptApplicationEmptyLiterals.test.ts b/src/application/javascript/JavaScriptApplicationEmptyLiterals.test.ts index a3a425bf99..1503bf634d 100644 --- a/src/application/javascript/JavaScriptApplicationEmptyLiterals.test.ts +++ b/src/application/javascript/JavaScriptApplicationEmptyLiterals.test.ts @@ -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);",