@shopbite-de/storefront 2.4.0 → 2.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/.env.example +13 -1
  2. package/CLAUDE.md +5 -3
  3. package/app/components/Home/Categories.vue +2 -2
  4. package/app/components/Navigation/MobileTop.vue +1 -1
  5. package/app/composables/useAddressAutocomplete.ts +3 -11
  6. package/app/composables/useCheckoutMethodGuard.ts +1 -1
  7. package/app/composables/useShippingMethodChoice.ts +2 -2
  8. package/app/composables/useTrackEvent.ts +4 -3
  9. package/app/pages/account/recover/password/index.vue +10 -0
  10. package/app/pages/registrierung/bestaetigen.vue +4 -0
  11. package/app/utils/openingHours.ts +1 -1
  12. package/app/utils/schema.ts +2 -2
  13. package/app/utils/trackingUrl.ts +39 -0
  14. package/content/index.yml +16 -16
  15. package/content/zahlung-und-versand.md +3 -3
  16. package/docs/notes/2026-07-04-issue-239-hydration-mismatches.md +1 -1
  17. package/docs/notes/2026-09-08-issue-244-category-url-trailing-slash.md +2 -2
  18. package/docs/notes/2026-09-10-issue-251-shop-data-in-base-layer.md +4 -4
  19. package/docs/notes/2026-09-10-issue-272-restaurant-schema.md +3 -3
  20. package/docs/notes/2026-09-10-issue-273-performance-media.md +4 -4
  21. package/docs/notes/2026-09-10-issue-274-seo-basics.md +6 -6
  22. package/docs/notes/2026-09-10-issue-275-accessibility.md +3 -3
  23. package/docs/notes/2026-09-10-issue-290-footer-nap.md +5 -5
  24. package/docs/notes/2026-09-10-issue-294-matomo-without-config.md +1 -1
  25. package/docs/notes/2026-09-10-issue-296-track-direct-search.md +1 -1
  26. package/docs/notes/2026-09-10-issue-312-store-api-criteria-post.md +3 -3
  27. package/docs/notes/2026-09-10-issue-313-wishlist-scoped-tailwind.md +1 -1
  28. package/docs/notes/2026-09-10-issue-314-mobile-js-cost.md +1 -1
  29. package/docs/notes/2026-09-12-issue-319-stylesheet-cost.md +1 -1
  30. package/docs/notes/2026-09-12-issue-325-product-card.md +2 -2
  31. package/docs/notes/2026-09-12-issue-327-home-hero.md +2 -2
  32. package/docs/notes/2026-09-13-issue-332-home-info-cards.md +1 -1
  33. package/docs/notes/2026-09-13-quick-view-flicker.md +1 -1
  34. package/docs/notes/2026-09-14-demo-noindex.md +2 -2
  35. package/docs/notes/2026-09-17-quick-view-compact-options.md +1 -1
  36. package/docs/notes/2026-09-21-issue-273-cache-and-demo-video.md +1 -1
  37. package/docs/notes/2026-09-21-issue-363-non-fatal-404.md +2 -2
  38. package/docs/notes/2026-09-21-issue-366-wishlist-404.md +1 -1
  39. package/docs/notes/2026-09-21-issue-378-dev-modules.md +1 -1
  40. package/docs/notes/2026-10-05-issue-289-product-deep-links.md +1 -1
  41. package/docs/notes/2026-10-05-issue-400-menu-item-ingredients-diet.md +1 -1
  42. package/docs/notes/2026-10-05-issue-401-restaurant-schema-ordering.md +1 -1
  43. package/docs/notes/2026-10-05-issue-402-llms-txt.md +1 -1
  44. package/docs/notes/2026-10-05-issue-403-ai-crawlers.md +1 -1
  45. package/docs/notes/2026-10-05-issue-404-faq.md +1 -1
  46. package/docs/notes/2026-10-06-old-seo-url-redirect.md +5 -5
  47. package/docs/notes/2026-10-07-issue-434-property-group-projection.md +1 -1
  48. package/nuxt.config.ts +56 -8
  49. package/package.json +2 -1
  50. package/server/api/address/autocomplete.get.ts +79 -14
  51. package/server/api/listing/[categoryId].get.ts +5 -28
  52. package/server/api/search.get.ts +4 -18
  53. package/server/plugins/bounded-cache.ts +28 -0
  54. package/server/plugins/security-headers.ts +54 -0
  55. package/server/routes/llms.txt.ts +1 -1
  56. package/server/utils/addressAutocomplete.ts +181 -0
  57. package/server/utils/listingParams.ts +117 -0
  58. package/server/utils/securityHeaders.ts +165 -0
  59. package/test/layer/nuxt.config.ts +2 -2
  60. package/test/nuxt/AccountPagesPreset.test.ts +10 -10
  61. package/test/nuxt/AuthPagesPreset.test.ts +3 -0
  62. package/test/nuxt/CheckoutFormsPreset.test.ts +5 -5
  63. package/test/nuxt/CheckoutSummary.test.ts +1 -1
  64. package/test/nuxt/HeaderFooterPreset.test.ts +10 -10
  65. package/test/nuxt/HomeFaq.test.ts +1 -1
  66. package/test/nuxt/NavigationMobileTop.test.ts +1 -1
  67. package/test/nuxt/OrderPagesPreset.test.ts +2 -2
  68. package/test/nuxt/RegisterConfirmPage.test.ts +12 -0
  69. package/test/nuxt/useAddressAutocomplete.test.ts +7 -22
  70. package/test/nuxt/useCheckoutMethodGuard.test.ts +1 -1
  71. package/test/nuxt/useShippingMethodChoice.test.ts +1 -1
  72. package/test/nuxt/useTrackEvent.test.ts +16 -0
  73. package/test/unit/addressAutocomplete.spec.ts +247 -0
  74. package/test/unit/boundedCache.spec.ts +231 -0
  75. package/test/unit/highlight.spec.ts +2 -2
  76. package/test/unit/llmsTxt.spec.ts +28 -28
  77. package/test/unit/openingHours.spec.ts +3 -3
  78. package/test/unit/schema.spec.ts +29 -32
  79. package/test/unit/securityHeaders.spec.ts +254 -0
  80. package/test/unit/seo.spec.ts +23 -29
  81. package/test/unit/sitemap.spec.ts +1 -1
  82. package/test/unit/trackingUrl.spec.ts +48 -0
@@ -0,0 +1,254 @@
1
+ import { createHash } from "node:crypto";
2
+ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
3
+ import {
4
+ contentSecurityPolicyReportOnly,
5
+ inlineScriptHashes,
6
+ securityHeaders,
7
+ type SecurityHeadersConfig,
8
+ } from "../../server/utils/securityHeaders";
9
+
10
+ const CONFIG: SecurityHeadersConfig = {
11
+ strictTransportSecurity: "max-age=31536000; includeSubDomains",
12
+ contentTypeOptions: "nosniff",
13
+ frameOptions: "DENY",
14
+ frameAncestors: "'none'",
15
+ referrerPolicy: "strict-origin-when-cross-origin",
16
+ permissionsPolicy: "camera=(), microphone=(), geolocation=()",
17
+ htmlCacheControl: "private, no-store",
18
+ contentSecurityPolicyReportOnly: { enabled: true },
19
+ };
20
+
21
+ const sha = (content: string) =>
22
+ `'sha256-${createHash("sha256").update(content).digest("base64")}'`;
23
+
24
+ describe("securityHeaders", () => {
25
+ it("sends the hardening headers for an https shop", () => {
26
+ expect(securityHeaders(CONFIG, "https://shop.example.com")).toEqual({
27
+ "strict-transport-security": "max-age=31536000; includeSubDomains",
28
+ "x-content-type-options": "nosniff",
29
+ "x-frame-options": "DENY",
30
+ "content-security-policy": "frame-ancestors 'none'",
31
+ "referrer-policy": "strict-origin-when-cross-origin",
32
+ "permissions-policy": "camera=(), microphone=(), geolocation=()",
33
+ });
34
+ });
35
+
36
+ it("sends no HSTS when the store URL is not https", () => {
37
+ for (const url of ["http://localhost:3000", "", undefined, "nonsense"]) {
38
+ expect(securityHeaders(CONFIG, url)).not.toHaveProperty(
39
+ "strict-transport-security",
40
+ );
41
+ }
42
+ });
43
+
44
+ it("leaves a header out when its value is empty", () => {
45
+ const headers = securityHeaders(
46
+ {
47
+ ...CONFIG,
48
+ frameOptions: "",
49
+ frameAncestors: "https://partner.example",
50
+ },
51
+ "https://shop.example.com",
52
+ );
53
+
54
+ expect(headers).not.toHaveProperty("x-frame-options");
55
+ expect(headers["content-security-policy"]).toBe(
56
+ "frame-ancestors https://partner.example",
57
+ );
58
+ expect(securityHeaders({}, "https://shop.example.com")).toEqual({});
59
+ });
60
+ });
61
+
62
+ describe("inlineScriptHashes", () => {
63
+ it("hashes executable inline scripts only", () => {
64
+ const config = "window.__NUXT__={};window.__NUXT__.config={}";
65
+ const importMap = '{"imports":{"#entry":"/_nuxt/a.js"}}';
66
+ const html = [
67
+ `<script type="importmap">${importMap}</script>`,
68
+ `<script>${config}</script>`,
69
+ '<script type="module" src="/_nuxt/a.js" crossorigin></script>',
70
+ '<script type="application/json" id="__NUXT_DATA__">[1]</script>',
71
+ '<script type="application/ld+json">{"@type":"Restaurant"}</script>',
72
+ ].join("");
73
+
74
+ expect(inlineScriptHashes(html)).toEqual([sha(importMap), sha(config)]);
75
+ });
76
+ });
77
+
78
+ describe("contentSecurityPolicyReportOnly", () => {
79
+ const directives = (policy: string) =>
80
+ Object.fromEntries(
81
+ policy.split("; ").map((d) => {
82
+ const [name, ...values] = d.split(" ");
83
+ return [name, values];
84
+ }),
85
+ );
86
+
87
+ it("allows self, Shopware, Matomo, the configured hosts and the hashes", () => {
88
+ const policy = directives(
89
+ contentSecurityPolicyReportOnly({
90
+ config: {
91
+ enabled: true,
92
+ connectSrc: "https://rum.example.com",
93
+ scriptSrc: "https://cdn.example.com",
94
+ reportUri: "https://rum.example.com/csp",
95
+ },
96
+ scriptHashes: ["'sha256-abc'"],
97
+ shopwareEndpoint: "https://api.example.com/store-api",
98
+ matomoUrl: "https://stats.example.com/",
99
+ }),
100
+ );
101
+
102
+ expect(policy["default-src"]).toEqual(["'self'"]);
103
+ expect(policy["script-src"]).toEqual([
104
+ "'self'",
105
+ "'sha256-abc'",
106
+ "https://stats.example.com",
107
+ "https://cdn.example.com",
108
+ ]);
109
+ expect(policy["connect-src"]).toEqual([
110
+ "'self'",
111
+ "https://api.example.com",
112
+ "https://stats.example.com",
113
+ "https://rum.example.com",
114
+ ]);
115
+ expect(policy["object-src"]).toEqual(["'none'"]);
116
+ expect(policy["report-uri"]).toEqual(["https://rum.example.com/csp"]);
117
+ expect(policy["script-src"]).not.toContain("'unsafe-inline'");
118
+ });
119
+
120
+ it("leaves out unset hosts", () => {
121
+ const policy = directives(
122
+ contentSecurityPolicyReportOnly({
123
+ config: { enabled: true },
124
+ scriptHashes: [],
125
+ }),
126
+ );
127
+
128
+ expect(policy["script-src"]).toEqual(["'self'"]);
129
+ expect(policy["connect-src"]).toEqual(["'self'"]);
130
+ expect(policy).not.toHaveProperty("report-uri");
131
+ });
132
+ });
133
+
134
+ describe("security headers plugin", () => {
135
+ type Hook = (...args: unknown[]) => void;
136
+ let hooks: Record<string, Hook>;
137
+ let setResponseHeaders: ReturnType<typeof vi.fn>;
138
+
139
+ async function loadPlugin(config: SecurityHeadersConfig = CONFIG) {
140
+ vi.resetModules();
141
+ hooks = {};
142
+ setResponseHeaders = vi.fn();
143
+ const utils = await import("../../server/utils/securityHeaders");
144
+ vi.stubGlobal("defineNitroPlugin", (plugin: unknown) => plugin);
145
+ vi.stubGlobal("setResponseHeaders", setResponseHeaders);
146
+ vi.stubGlobal("useRuntimeConfig", () => ({
147
+ securityHeaders: config,
148
+ public: {
149
+ storeUrl: "https://shop.example.com",
150
+ shopware: { endpoint: "https://api.example.com/store-api" },
151
+ scripts: { matomoAnalytics: { matomoUrl: "", siteId: "" } },
152
+ },
153
+ }));
154
+ for (const [name, value] of Object.entries(utils)) {
155
+ vi.stubGlobal(name, value);
156
+ }
157
+ const plugin = (await import("../../server/plugins/security-headers"))
158
+ .default as unknown as (app: unknown) => void;
159
+ plugin({ hooks: { hook: (name: string, fn: Hook) => (hooks[name] = fn) } });
160
+ }
161
+
162
+ const render = (headers: Record<string, string>, body = "<html></html>") => {
163
+ const event = { node: { res: { removeHeader: vi.fn() } } };
164
+ const response = { body, headers };
165
+ hooks["render:response"]!(response, { event });
166
+ return { response, event };
167
+ };
168
+
169
+ beforeEach(() => loadPlugin());
170
+ afterEach(() => vi.unstubAllGlobals());
171
+
172
+ it("sets the headers on every request", () => {
173
+ const event = {};
174
+ hooks.request!(event);
175
+
176
+ expect(setResponseHeaders).toHaveBeenCalledWith(
177
+ event,
178
+ expect.objectContaining({
179
+ "strict-transport-security": "max-age=31536000; includeSubDomains",
180
+ "x-frame-options": "DENY",
181
+ }),
182
+ );
183
+ });
184
+
185
+ it("marks rendered HTML private and removes x-powered-by", () => {
186
+ const { response, event } = render({
187
+ "content-type": "text/html;charset=utf-8",
188
+ "x-powered-by": "Nuxt",
189
+ });
190
+
191
+ expect(response.headers["cache-control"]).toBe("private, no-store");
192
+ expect(response.headers).not.toHaveProperty("x-powered-by");
193
+ expect(event.node.res.removeHeader).toHaveBeenCalledWith("x-powered-by");
194
+ });
195
+
196
+ it("keeps a Cache-Control set by a route rule", () => {
197
+ const { response } = render({
198
+ "content-type": "text/html",
199
+ "cache-control": "public, max-age=60",
200
+ });
201
+
202
+ expect(response.headers["cache-control"]).toBe("public, max-age=60");
203
+ });
204
+
205
+ it("leaves non-HTML responses uncached by the rule", () => {
206
+ const { response } = render({ "content-type": "text/plain" });
207
+
208
+ expect(response.headers).not.toHaveProperty("cache-control");
209
+ expect(response.headers).not.toHaveProperty(
210
+ "content-security-policy-report-only",
211
+ );
212
+ });
213
+
214
+ it("adds a report-only policy with the hashes of the page's inline scripts", () => {
215
+ const script = "window.__NUXT__={}";
216
+ const { response } = render(
217
+ { "content-type": "text/html" },
218
+ `<html><script>${script}</script></html>`,
219
+ );
220
+
221
+ const policy = response.headers["content-security-policy-report-only"];
222
+ expect(policy).toContain(`script-src 'self' ${sha(script)}`);
223
+ expect(policy).toContain("connect-src 'self' https://api.example.com");
224
+ });
225
+
226
+ it("sends no report-only policy when it is disabled", async () => {
227
+ await loadPlugin({
228
+ ...CONFIG,
229
+ contentSecurityPolicyReportOnly: { enabled: false },
230
+ });
231
+ const { response } = render({ "content-type": "text/html" });
232
+
233
+ expect(response.headers).not.toHaveProperty(
234
+ "content-security-policy-report-only",
235
+ );
236
+ });
237
+ });
238
+
239
+ describe("nuxt.config", () => {
240
+ afterEach(() => vi.unstubAllGlobals());
241
+
242
+ it("lets the service worker cache no pages", async () => {
243
+ vi.stubGlobal("defineNuxtConfig", (config: unknown) => config);
244
+ const config = (await import("../../nuxt.config")).default as {
245
+ pwa: { generateSW: { runtimeCaching?: unknown[] } };
246
+ runtimeConfig: { securityHeaders: SecurityHeadersConfig };
247
+ };
248
+
249
+ expect(config.pwa.generateSW.runtimeCaching ?? []).toEqual([]);
250
+ expect(config.runtimeConfig.securityHeaders.htmlCacheControl).toBe(
251
+ "private, no-store",
252
+ );
253
+ });
254
+ });
@@ -11,23 +11,19 @@ const TEMPLATE = "%s | %siteName – Online bestellen";
11
11
 
12
12
  describe("formatPageTitle", () => {
13
13
  it("applies the title template", () => {
14
- expect(formatPageTitle("Pizza", "La Fattoria", TEMPLATE)).toBe(
15
- "Pizza | La Fattoria – Online bestellen",
14
+ expect(formatPageTitle("Pizza", "Esempio", TEMPLATE)).toBe(
15
+ "Pizza | Esempio – Online bestellen",
16
16
  );
17
17
  });
18
18
 
19
19
  it("renders the bare site name for a missing or site-name title", () => {
20
- expect(formatPageTitle(undefined, "La Fattoria", TEMPLATE)).toBe(
21
- "La Fattoria",
22
- );
23
- expect(formatPageTitle("", "La Fattoria", TEMPLATE)).toBe("La Fattoria");
24
- expect(formatPageTitle("La Fattoria", "La Fattoria", TEMPLATE)).toBe(
25
- "La Fattoria",
26
- );
20
+ expect(formatPageTitle(undefined, "Esempio", TEMPLATE)).toBe("Esempio");
21
+ expect(formatPageTitle("", "Esempio", TEMPLATE)).toBe("Esempio");
22
+ expect(formatPageTitle("Esempio", "Esempio", TEMPLATE)).toBe("Esempio");
27
23
  });
28
24
 
29
25
  it("renders the title as is without a template", () => {
30
- expect(formatPageTitle("Pizza", "La Fattoria", "")).toBe("Pizza");
26
+ expect(formatPageTitle("Pizza", "Esempio", "")).toBe("Pizza");
31
27
  });
32
28
  });
33
29
 
@@ -56,20 +52,20 @@ describe("toAbsoluteUrl", () => {
56
52
 
57
53
  describe("buildHomeTitle", () => {
58
54
  it("adds the city to the shop name", () => {
59
- expect(buildHomeTitle({ name: "La Fattoria", city: "Obertshausen" })).toBe(
60
- "La Fattoria Obertshausen | Online bestellen & liefern lassen",
55
+ expect(buildHomeTitle({ name: "Esempio", city: "Musterstadt" })).toBe(
56
+ "Esempio Musterstadt | Online bestellen & liefern lassen",
61
57
  );
62
58
  });
63
59
 
64
60
  it("does not repeat a city that is already part of the name", () => {
65
61
  expect(
66
- buildHomeTitle({ name: "Pizzeria Obertshausen", city: "Obertshausen" }),
67
- ).toBe("Pizzeria Obertshausen | Online bestellen & liefern lassen");
62
+ buildHomeTitle({ name: "Pizzeria Musterstadt", city: "Musterstadt" }),
63
+ ).toBe("Pizzeria Musterstadt | Online bestellen & liefern lassen");
68
64
  });
69
65
 
70
66
  it("works without a city", () => {
71
- expect(buildHomeTitle({ name: "La Fattoria", city: "" })).toBe(
72
- "La Fattoria | Online bestellen & liefern lassen",
67
+ expect(buildHomeTitle({ name: "Esempio", city: "" })).toBe(
68
+ "Esempio | Online bestellen & liefern lassen",
73
69
  );
74
70
  });
75
71
  });
@@ -78,40 +74,38 @@ describe("buildHomeDescription", () => {
78
74
  it("combines cuisine, city and name", () => {
79
75
  expect(
80
76
  buildHomeDescription({
81
- name: "La Fattoria",
82
- city: "Obertshausen",
77
+ name: "Esempio",
78
+ city: "Musterstadt",
83
79
  cuisine: "Italienische Küche",
84
80
  }),
85
81
  ).toBe(
86
- "Italienische Küche in Obertshausen: Bei La Fattoria online bestellen und liefern lassen oder abholen.",
82
+ "Italienische Küche in Musterstadt: Bei Esempio online bestellen und liefern lassen oder abholen.",
87
83
  );
88
84
  });
89
85
 
90
86
  it("uses city or cuisine alone", () => {
91
- expect(
92
- buildHomeDescription({ name: "La Fattoria", city: "Obertshausen" }),
93
- ).toBe(
94
- "La Fattoria in Obertshausen: Online bestellen und liefern lassen oder abholen.",
87
+ expect(buildHomeDescription({ name: "Esempio", city: "Musterstadt" })).toBe(
88
+ "Esempio in Musterstadt: Online bestellen und liefern lassen oder abholen.",
95
89
  );
96
90
  expect(
97
- buildHomeDescription({ name: "La Fattoria", cuisine: "Pizza & Pasta" }),
91
+ buildHomeDescription({ name: "Esempio", cuisine: "Pizza & Pasta" }),
98
92
  ).toBe(
99
- "Pizza & Pasta: Bei La Fattoria online bestellen und liefern lassen oder abholen.",
93
+ "Pizza & Pasta: Bei Esempio online bestellen und liefern lassen oder abholen.",
100
94
  );
101
95
  });
102
96
 
103
97
  it("returns undefined without city and cuisine", () => {
104
98
  expect(
105
- buildHomeDescription({ name: "La Fattoria", city: "", cuisine: "" }),
99
+ buildHomeDescription({ name: "Esempio", city: "", cuisine: "" }),
106
100
  ).toBeUndefined();
107
101
  });
108
102
  });
109
103
 
110
104
  describe("splitList", () => {
111
105
  it("splits a comma-separated value and keeps arrays", () => {
112
- expect(splitList("63179 Obertshausen, 63165 Lämmerspiel,")).toEqual([
113
- "63179 Obertshausen",
114
- "63165 Lämmerspiel",
106
+ expect(splitList("12345 Musterstadt, 12346 Beispieldorf,")).toEqual([
107
+ "12345 Musterstadt",
108
+ "12346 Beispieldorf",
115
109
  ]);
116
110
  expect(splitList(["A", "B"])).toEqual(["A", "B"]);
117
111
  expect(splitList("")).toEqual([]);
@@ -50,7 +50,7 @@ describe("categoriesToSitemapUrls", () => {
50
50
  seoUrl: "/navigation/018d9f1649c9709580aab97a16368d8d",
51
51
  },
52
52
  { type: "link", seoUrl: "/agb" },
53
- { type: "link", seoUrl: "tel:+491726723920" },
53
+ { type: "link", seoUrl: "tel:+49123456780" },
54
54
  { type: "folder", seoUrl: null },
55
55
  { type: "page", seoUrl: "//evil.example.com/" },
56
56
  { type: "page" },
@@ -0,0 +1,48 @@
1
+ import { describe, expect, it } from "vitest";
2
+ import { trackingUrl } from "../../app/utils/trackingUrl";
3
+
4
+ describe("trackingUrl", () => {
5
+ it("keeps a plain path", () => {
6
+ expect(trackingUrl("/Speisekarte/Pizza/")).toBe("/Speisekarte/Pizza/");
7
+ });
8
+
9
+ it("drops query parameters that may carry secrets", () => {
10
+ expect(trackingUrl("/account/recover/password?hash=abc123")).toBe(
11
+ "/account/recover/password",
12
+ );
13
+ expect(trackingUrl("/registrierung/bestaetigen?em=e1&hash=h1")).toBe(
14
+ "/registrierung/bestaetigen",
15
+ );
16
+ expect(
17
+ trackingUrl("/bestellung/1?token=t&deepLinkCode=d&email=a@b.c"),
18
+ ).toBe("/bestellung/1");
19
+ });
20
+
21
+ it("drops the fragment", () => {
22
+ expect(trackingUrl("/konto#access_token=x")).toBe("/konto");
23
+ expect(trackingUrl("/?produkt=P1#x")).toBe("/?produkt=P1");
24
+ });
25
+
26
+ it("keeps campaign parameters and the quick view configuration", () => {
27
+ expect(
28
+ trackingUrl(
29
+ "/Speisekarte/Pizza/?produkt=P1&ohne=Zwiebeln&extras=E1&hash=x",
30
+ ),
31
+ ).toBe("/Speisekarte/Pizza/?produkt=P1&ohne=Zwiebeln&extras=E1");
32
+ expect(
33
+ trackingUrl(
34
+ "/?utm_source=flyer&utm_medium=print&mtm_campaign=a&pk_kwd=b&em=x",
35
+ ),
36
+ ).toBe("/?utm_source=flyer&utm_medium=print&mtm_campaign=a&pk_kwd=b");
37
+ });
38
+
39
+ it("matches parameter names exactly, not by prefix", () => {
40
+ expect(trackingUrl("/?produkt_hash=x&extrasToken=y&utm=z")).toBe("/");
41
+ });
42
+
43
+ it("keeps encoded values as they are", () => {
44
+ expect(trackingUrl("/?ohne=K%C3%A4se&extras=E1%2CE2")).toBe(
45
+ "/?ohne=K%C3%A4se&extras=E1%2CE2",
46
+ );
47
+ });
48
+ });