Skip to content

armgit / rea

Public Imported from GitHub
0

Reverse engineer anything with agents, from app behavior down to native binaries.

test(javascript): cover plain long-line loader identities (#1025)

Ysopwnable984fc27ce19d
diff --git a/src/application/javascript/JavaScriptApplicationEmptyLiterals.test.ts b/src/application/javascript/JavaScriptApplicationEmptyLiterals.test.ts
index a3a425bf9..1503bf634 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);",