diff --git a/src/domain/analysisView/webBundleView.test.ts b/src/domain/analysisView/webBundleView.test.ts index d0cc66bd4a..5c3f05683c 100644 --- a/src/domain/analysisView/webBundleView.test.ts +++ b/src/domain/analysisView/webBundleView.test.ts @@ -223,8 +223,8 @@ it("filters endpoints by values, script_keys, mechanisms, and field projections" expect(item.location).toMatchObject({ script_key: "vendor.js" }); }); -it("returns merged endpoint occurrences and script_keys on an unfiltered page", () => { - const parent = makeParent({ +const mergedEndpointParent = (ordersScriptKey: string) => + makeParent({ observations: { ...sampleWebBundleAnalysis().observations, endpoints: [ @@ -238,12 +238,14 @@ it("returns merged endpoint occurrences and script_keys on an unfiltered page", { value: "/api/orders", mechanism: "call:sendBeacon", - location: { script_key: "app.js", line: 85, column: 4 }, + location: { script_key: ordersScriptKey, line: 85, column: 4 }, }, ], }, }); +it("returns merged endpoint occurrences and script_keys on an unfiltered page", () => { + const parent = mergedEndpointParent("app.js"); const page = query(parent, { kind: "web-bundle", collection: "endpoints", @@ -268,26 +270,7 @@ it("returns merged endpoint occurrences and script_keys on an unfiltered page", }); it("matches a merged endpoint by any retained script key", () => { - const parent = makeParent({ - observations: { - ...sampleWebBundleAnalysis().observations, - endpoints: [ - { - value: "/api/shared", - mechanism: "call:fetch", - location: { script_key: "app.js", line: 10, column: 2 }, - occurrences: 2, - script_keys: ["app.js", "vendor.js"], - }, - { - value: "/api/orders", - mechanism: "call:sendBeacon", - location: { script_key: "vendor.js", line: 85, column: 4 }, - }, - ], - }, - }); - + const parent = mergedEndpointParent("vendor.js"); const bySecondScript = query(parent, { kind: "web-bundle", collection: "endpoints",