@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,231 @@
1
+ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
2
+ import { createStorage } from "unstorage";
3
+ import { stubNitro, type CachedHandler } from "./nitroStubs";
4
+
5
+ const CATEGORY = "018dadb399837af3aa669c8fff4f4d6c";
6
+ const A = "0197baf0a6a971eaada59ed5c84138de";
7
+ const B = "018dbccef8257618b0b3a541f513aa9e";
8
+
9
+ const load = async <T>(path: string): Promise<T> =>
10
+ (await import(/* @vite-ignore */ path)).default as T;
11
+
12
+ async function route(path: string) {
13
+ const params = await import("../../server/utils/listingParams");
14
+ const stubs = stubNitro({ ...params, $fetch: vi.fn(), MEDIA_INCLUDES: {} });
15
+ return { stubs, ...(await load<CachedHandler>(path)) };
16
+ }
17
+
18
+ beforeEach(() => {
19
+ vi.resetModules();
20
+ });
21
+
22
+ afterEach(() => {
23
+ vi.unstubAllGlobals();
24
+ });
25
+
26
+ const listingEvent = (query: Record<string, unknown>) => ({
27
+ params: { categoryId: CATEGORY },
28
+ query,
29
+ });
30
+
31
+ describe("/api/listing/[categoryId] cache key", () => {
32
+ it("keys property and manufacturer filters as sorted lower-case ids", async () => {
33
+ const { opts, handler, stubs } = await route(
34
+ "../../server/api/listing/[categoryId].get",
35
+ );
36
+ const query = { properties: `${B.toUpperCase()}|${A}|${A}`, p: "2" };
37
+
38
+ expect(await opts.getKey(listingEvent(query))).toBe(
39
+ [CATEGORY, "", `${B}|${A}`, "", "", 2].join("|"),
40
+ );
41
+ await handler(listingEvent(query));
42
+ expect(stubs.storeApiPost).toHaveBeenCalledWith(
43
+ `/product-listing/${CATEGORY}`,
44
+ expect.objectContaining({ properties: `${B}|${A}`, p: 2 }),
45
+ expect.anything(),
46
+ );
47
+ });
48
+
49
+ it.each([
50
+ ["properties", "Käse"],
51
+ ["properties", `${A}|`],
52
+ ["properties", Array.from({ length: 51 }, () => A).join("|")],
53
+ ["manufacturer", "x".repeat(32)],
54
+ ["order", "random-key"],
55
+ ["p", "21"],
56
+ ["p", "0"],
57
+ ["p", "1.5"],
58
+ ["query", "x".repeat(101)],
59
+ ["properties", [A, B]],
60
+ ])("rejects %s=%s with 400 before it becomes a key", async (name, value) => {
61
+ const { opts, handler, stubs } = await route(
62
+ "../../server/api/listing/[categoryId].get",
63
+ );
64
+ const event = listingEvent({ [name]: value });
65
+
66
+ expect(() => opts.getKey(event)).toThrow(
67
+ expect.objectContaining({ statusCode: 400 }),
68
+ );
69
+ await expect(handler(event)).rejects.toMatchObject({ statusCode: 400 });
70
+ expect(stubs.storeApiPost).not.toHaveBeenCalled();
71
+ });
72
+
73
+ it("rejects a category id that is not 32 hex characters", async () => {
74
+ const { opts } = await route("../../server/api/listing/[categoryId].get");
75
+
76
+ expect(() =>
77
+ opts.getKey({ params: { categoryId: "pizza" }, query: {} }),
78
+ ).toThrow(expect.objectContaining({ statusCode: 400 }));
79
+ });
80
+
81
+ it("accepts Shopware's standard sortings", async () => {
82
+ const { opts } = await route("../../server/api/listing/[categoryId].get");
83
+
84
+ for (const order of ["name-asc", "name-desc", "price-asc", "topseller"]) {
85
+ expect(await opts.getKey(listingEvent({ order }))).toContain(order);
86
+ }
87
+ });
88
+
89
+ it("accepts the sortings configured for the shop", async () => {
90
+ const params = await import("../../server/utils/listingParams");
91
+ stubNitro({
92
+ ...params,
93
+ MEDIA_INCLUDES: {},
94
+ useRuntimeConfig: () => ({
95
+ listingSortings: "name-asc, menu-number",
96
+ public: { shopBite: { cacheTtl: { listing: 1 } } },
97
+ }),
98
+ });
99
+ const { opts } = await load<CachedHandler>(
100
+ "../../server/api/listing/[categoryId].get",
101
+ );
102
+
103
+ expect(await opts.getKey(listingEvent({ order: "menu-number" }))).toContain(
104
+ "menu-number",
105
+ );
106
+ expect(() => opts.getKey(listingEvent({ order: "price-asc" }))).toThrow();
107
+ });
108
+
109
+ it("normalises whitespace of the text query", async () => {
110
+ const { opts } = await route("../../server/api/listing/[categoryId].get");
111
+
112
+ expect(
113
+ await opts.getKey(listingEvent({ query: " Pizza Salami " })),
114
+ ).toBe([CATEGORY, "", "", "", "Pizza Salami", 1].join("|"));
115
+ });
116
+ });
117
+
118
+ describe("/api/search cache key", () => {
119
+ it.each([
120
+ [{ query: "x".repeat(101) }],
121
+ [{ query: "pizza", order: "x" }],
122
+ [{ query: "pizza", p: "99" }],
123
+ [{ query: ["pizza", "salami"] }],
124
+ ])("rejects %o with 400", async (query) => {
125
+ const { opts, handler, stubs } = await route("../../server/api/search.get");
126
+
127
+ expect(() => opts.getKey({ query })).toThrow(
128
+ expect.objectContaining({ statusCode: 400 }),
129
+ );
130
+ await expect(handler({ query })).rejects.toMatchObject({
131
+ statusCode: 400,
132
+ });
133
+ expect(stubs.$fetch).not.toHaveBeenCalled();
134
+ });
135
+
136
+ it("keys a valid search", async () => {
137
+ const { opts } = await route("../../server/api/search.get");
138
+
139
+ expect(
140
+ await opts.getKey({ query: { query: " pizza ", order: "score" } }),
141
+ ).toBe("pizza|score|1");
142
+ });
143
+ });
144
+
145
+ describe("bounded cache storage", () => {
146
+ async function mountWith(
147
+ config: Record<string, unknown>,
148
+ storage = createStorage(),
149
+ ) {
150
+ vi.stubGlobal("defineNitroPlugin", (plugin: unknown) => plugin);
151
+ vi.stubGlobal("useRuntimeConfig", () => ({ cacheStorage: config }));
152
+ vi.stubGlobal("useStorage", () => storage);
153
+ const plugin = await load<() => void>("../../server/plugins/bounded-cache");
154
+ plugin();
155
+ return storage;
156
+ }
157
+
158
+ it("keeps at most maxEntries cache entries", async () => {
159
+ const storage = await mountWith({ maxEntries: 3, maxSizeMb: 1 });
160
+
161
+ for (const n of [1, 2, 3, 4, 5]) {
162
+ await storage.setItem(`cache:nitro:handlers:search:q${n}.json`, {
163
+ value: n,
164
+ });
165
+ }
166
+
167
+ expect(await storage.getKeys("cache:nitro")).toHaveLength(3);
168
+ expect(await storage.getItem("cache:nitro:handlers:search:q1.json")).toBe(
169
+ null,
170
+ );
171
+ expect(
172
+ await storage.getItem("cache:nitro:handlers:search:q5.json"),
173
+ ).toEqual({ value: 5 });
174
+ // other mounts are not affected
175
+ await storage.setItem("data:x", 1);
176
+ expect(await storage.getItem("data:x")).toBe(1);
177
+ });
178
+
179
+ it("keeps at most maxSizeMb of cache data", async () => {
180
+ const storage = await mountWith({ maxEntries: 1000, maxSizeMb: 1 });
181
+ const big = "x".repeat(400_000);
182
+
183
+ for (const n of [1, 2, 3, 4]) {
184
+ await storage.setItem(`cache:nitro:handlers:listing:l${n}.json`, big);
185
+ }
186
+
187
+ expect((await storage.getKeys("cache:nitro")).length).toBeLessThanOrEqual(
188
+ 2,
189
+ );
190
+ });
191
+
192
+ it("leaves a cache storage the shop mounted itself", async () => {
193
+ const own = createStorage();
194
+ const { default: memory } = await import("unstorage/drivers/memory");
195
+ own.mount("cache", memory());
196
+ const driver = own.getMount("cache:").driver;
197
+
198
+ await mountWith({ maxEntries: 3, maxSizeMb: 1 }, own);
199
+
200
+ expect(own.getMount("cache:").driver).toBe(driver);
201
+ });
202
+
203
+ it("is off with maxEntries 0", async () => {
204
+ const storage = await mountWith({ maxEntries: 0, maxSizeMb: 1 });
205
+
206
+ expect(storage.getMount("cache:").base).toBe("");
207
+ });
208
+
209
+ it("still lets the purge find and remove the entries", async () => {
210
+ const storage = await mountWith({ maxEntries: 100, maxSizeMb: 1 });
211
+ const { keysToPurge } = await import("../../server/utils/cachePurge");
212
+ await storage.setItem(`cache:nitro:handlers:product:product${A}.json`, {
213
+ value: 1,
214
+ });
215
+ await storage.setItem(`cache:nitro:handlers:product:product${B}.json`, {
216
+ value: 2,
217
+ });
218
+ await storage.setItem(`cache:nitro:handlers:listing:${CATEGORY}1.json`, {
219
+ value: 3,
220
+ });
221
+
222
+ const keys = keysToPurge(await storage.getKeys("cache:nitro"), {
223
+ products: [A],
224
+ });
225
+ await Promise.all(keys.map((key) => storage.removeItem(key)));
226
+
227
+ expect(await storage.getKeys("cache:nitro")).toEqual([
228
+ `cache:nitro:handlers:product:product${B}.json`,
229
+ ]);
230
+ });
231
+ });
@@ -3,8 +3,8 @@ import { splitHighlight } from "../../app/utils/highlight";
3
3
 
4
4
  describe("splitHighlight", () => {
5
5
  it("keeps text without highlights as one part", () => {
6
- expect(splitHighlight("Pizzeria La Fattoria")).toEqual([
7
- { text: "Pizzeria La Fattoria", highlight: false },
6
+ expect(splitHighlight("Pizzeria Esempio")).toEqual([
7
+ { text: "Pizzeria Esempio", highlight: false },
8
8
  ]);
9
9
  });
10
10
 
@@ -6,17 +6,17 @@ const now = new Date("2026-10-05T12:00:00Z");
6
6
  describe("buildLlmsTxt", () => {
7
7
  it("renders shop, hours, ordering, menu and pages as Markdown", () => {
8
8
  const text = buildLlmsTxt({
9
- name: "Pizzeria La Fattoria",
9
+ name: "Pizzeria Esempio",
10
10
  description: "Italienisch-deutsche Küche seit 1997.",
11
- url: "https://www.pizzeria-lafattoria.de",
11
+ url: "https://www.pizzeria-esempio.example",
12
12
  cuisine: "Italienische Küche",
13
13
  address: {
14
- street: "Kantstraße 6",
15
- postalCode: "63179",
16
- city: "Obertshausen",
14
+ street: "Musterstraße 1",
15
+ postalCode: "12345",
16
+ city: "Musterstadt",
17
17
  },
18
- telephone: "+49 6104 71427",
19
- deliveryAreas: ["63179 Obertshausen", "63165 Lämmerspiel"],
18
+ telephone: "+49 123 456789",
19
+ deliveryAreas: ["12345 Musterstadt", "12346 Beispieldorf"],
20
20
  businessHours: [1, 2, 3, 4, 5].map((dayOfWeek) => ({
21
21
  dayOfWeek,
22
22
  openingTime: "11:30:00",
@@ -29,11 +29,11 @@ describe("buildLlmsTxt", () => {
29
29
  ],
30
30
  isCheckoutEnabled: true,
31
31
  deliveryTime: 30,
32
- menuUrl: "https://www.pizzeria-lafattoria.de/speisekarte",
32
+ menuUrl: "https://www.pizzeria-esempio.example/speisekarte",
33
33
  menu: [
34
34
  {
35
35
  name: "Pizza",
36
- url: "https://www.pizzeria-lafattoria.de/c/Pizza/",
36
+ url: "https://www.pizzeria-esempio.example/c/Pizza/",
37
37
  items: [
38
38
  {
39
39
  name: "Pizza Margherita",
@@ -45,7 +45,7 @@ describe("buildLlmsTxt", () => {
45
45
  {
46
46
  name: "Pizza Salami",
47
47
  price: 8.5,
48
- url: "https://www.pizzeria-lafattoria.de/c/Pizza/?produkt=22",
48
+ url: "https://www.pizzeria-esempio.example/c/Pizza/?produkt=22",
49
49
  },
50
50
  ],
51
51
  },
@@ -71,31 +71,31 @@ describe("buildLlmsTxt", () => {
71
71
  pages: [
72
72
  {
73
73
  title: "Zahlungs- und Lieferinformationen",
74
- url: "https://www.pizzeria-lafattoria.de/zahlung-und-versand",
74
+ url: "https://www.pizzeria-esempio.example/zahlung-und-versand",
75
75
  description: "Zahlungs- und Lieferinformationen",
76
76
  },
77
77
  ],
78
78
  faq: [
79
79
  {
80
80
  question: "Wohin liefern Sie?",
81
- answer: "Nach Obertshausen und Lämmerspiel.",
81
+ answer: "Nach Musterstadt und Beispieldorf.",
82
82
  },
83
83
  ],
84
84
  currency: "EUR",
85
85
  now,
86
86
  });
87
87
 
88
- expect(text).toBe(`# Pizzeria La Fattoria
88
+ expect(text).toBe(`# Pizzeria Esempio
89
89
 
90
- > Pizzeria La Fattoria: Italienische Küche in Obertshausen. Online bestellen zur Lieferung oder Abholung unter https://www.pizzeria-lafattoria.de.
90
+ > Pizzeria Esempio: Italienische Küche in Musterstadt. Online bestellen zur Lieferung oder Abholung unter https://www.pizzeria-esempio.example.
91
91
 
92
92
  Italienisch-deutsche Küche seit 1997.
93
93
 
94
94
  ## Kontakt
95
95
 
96
- - Adresse: Kantstraße 6, 63179 Obertshausen
97
- - Telefon: +49 6104 71427
98
- - Website: https://www.pizzeria-lafattoria.de
96
+ - Adresse: Musterstraße 1, 12345 Musterstadt
97
+ - Telefon: +49 123 456789
98
+ - Website: https://www.pizzeria-esempio.example
99
99
 
100
100
  ## Öffnungszeiten
101
101
 
@@ -105,8 +105,8 @@ Italienisch-deutsche Küche seit 1997.
105
105
 
106
106
  ## Bestellen
107
107
 
108
- - Online bestellen: https://www.pizzeria-lafattoria.de/speisekarte
109
- - Liefergebiet: 63179 Obertshausen, 63165 Lämmerspiel
108
+ - Online bestellen: https://www.pizzeria-esempio.example/speisekarte
109
+ - Liefergebiet: 12345 Musterstadt, 12346 Beispieldorf
110
110
  - Lieferzeit: ca. 30 Minuten
111
111
  - Abholung im Restaurant möglich
112
112
 
@@ -114,14 +114,14 @@ Italienisch-deutsche Küche seit 1997.
114
114
 
115
115
  ### Wohin liefern Sie?
116
116
 
117
- Nach Obertshausen und Lämmerspiel.
117
+ Nach Musterstadt und Beispieldorf.
118
118
 
119
119
  ## Speisekarte
120
120
 
121
- ### [Pizza](https://www.pizzeria-lafattoria.de/c/Pizza/)
121
+ ### [Pizza](https://www.pizzeria-esempio.example/c/Pizza/)
122
122
 
123
123
  - Pizza Margherita: ab 7,00 € (Tomatensoße, Mozzarella; vegetarisch)
124
- - [Pizza Salami](https://www.pizzeria-lafattoria.de/c/Pizza/?produkt=22): 8,50 €
124
+ - [Pizza Salami](https://www.pizzeria-esempio.example/c/Pizza/?produkt=22): 8,50 €
125
125
 
126
126
  ### Nudeln
127
127
 
@@ -131,22 +131,22 @@ Nach Obertshausen und Lämmerspiel.
131
131
 
132
132
  ## Weitere Informationen
133
133
 
134
- - [Zahlungs- und Lieferinformationen](https://www.pizzeria-lafattoria.de/zahlung-und-versand)
134
+ - [Zahlungs- und Lieferinformationen](https://www.pizzeria-esempio.example/zahlung-und-versand)
135
135
  `);
136
136
  });
137
137
 
138
138
  it("names other names of the shop under Kontakt", () => {
139
139
  expect(
140
140
  buildLlmsTxt({
141
- name: "Pizzeria La Fattoria",
142
- alternateNames: ["La Fattoria / Alte Schmiede", "Alte Schmiede"],
143
- url: "https://www.pizzeria-lafattoria.de",
141
+ name: "Pizzeria Esempio",
142
+ alternateNames: ["Esempio / Alter Hof", "Alter Hof"],
143
+ url: "https://www.pizzeria-esempio.example",
144
144
  now,
145
145
  }),
146
146
  ).toContain(`## Kontakt
147
147
 
148
- - Auch bekannt als: La Fattoria / Alte Schmiede, Alte Schmiede
149
- - Website: https://www.pizzeria-lafattoria.de
148
+ - Auch bekannt als: Esempio / Alter Hof, Alter Hof
149
+ - Website: https://www.pizzeria-esempio.example
150
150
  `);
151
151
  });
152
152
 
@@ -18,7 +18,7 @@ const dinner = (dayOfWeek: number) => ({
18
18
 
19
19
  describe("groupOpeningHours", () => {
20
20
  it("groups consecutive days with identical intervals", () => {
21
- // Pizzeria La Fattoria: closed on Tuesday, Saturday dinner only
21
+ // closed on Tuesday, Saturday dinner only
22
22
  const businessHours = [1, 3, 4, 5, 7].flatMap((day) => [
23
23
  dinner(day),
24
24
  lunch(day),
@@ -57,8 +57,8 @@ describe("groupOpeningHours", () => {
57
57
 
58
58
  describe("toTelHref", () => {
59
59
  it("strips formatting from the phone number", () => {
60
- expect(toTelHref("+49 6104 71427")).toBe("tel:+49610471427");
61
- expect(toTelHref("06104 / 71-427")).toBe("tel:0610471427");
60
+ expect(toTelHref("+49 123 456789")).toBe("tel:+49123456789");
61
+ expect(toTelHref("0123 / 456-789")).toBe("tel:0123456789");
62
62
  });
63
63
  });
64
64
 
@@ -81,19 +81,19 @@ describe("buildSpecialOpeningHoursSpecification", () => {
81
81
 
82
82
  describe("buildRestaurantSchema", () => {
83
83
  const site = {
84
- name: "Pizzeria La Fattoria",
85
- description: "Italienisch-deutsche Küche in Obertshausen seit 1997.",
86
- url: "https://www.pizzeria-lafattoria.de",
87
- image: "https://www.pizzeria-lafattoria.de/card.png",
88
- telephone: "+49 6104 71427",
84
+ name: "Pizzeria Esempio",
85
+ description: "Italienisch-deutsche Küche in Musterstadt seit 1997.",
86
+ url: "https://www.pizzeria-esempio.example",
87
+ image: "https://www.pizzeria-esempio.example/card.png",
88
+ telephone: "+49 123 456789",
89
89
  cuisine: "Italienisch",
90
90
  priceRange: "€€",
91
91
  googleBusinessProfileUrl: "https://maps.google.com/?cid=123",
92
92
  address: {
93
- street: "Kantstr. 6",
93
+ street: "Musterstr. 1",
94
94
  // a number: Nuxt parses a numeric env value
95
- postalCode: 63179 as unknown as string,
96
- city: "Obertshausen",
95
+ postalCode: 12345 as unknown as string,
96
+ city: "Musterstadt",
97
97
  country: "DE",
98
98
  },
99
99
  };
@@ -105,15 +105,15 @@ describe("buildRestaurantSchema", () => {
105
105
  holidays: [
106
106
  { start: "2026-07-12T21:00:00Z", end: "2026-08-05T22:00:00Z" },
107
107
  ],
108
- menuUrl: "https://www.pizzeria-lafattoria.de/speisekarte",
108
+ menuUrl: "https://www.pizzeria-esempio.example/speisekarte",
109
109
  menuSections: [
110
- { name: "Pizza", url: "https://www.pizzeria-lafattoria.de/c/Pizza/" },
110
+ { name: "Pizza", url: "https://www.pizzeria-esempio.example/c/Pizza/" },
111
111
  {
112
112
  name: "Nudeln",
113
113
  sections: [
114
114
  {
115
115
  name: "Spaghetti",
116
- url: "https://www.pizzeria-lafattoria.de/c/Nudeln/Spaghetti/",
116
+ url: "https://www.pizzeria-esempio.example/c/Nudeln/Spaghetti/",
117
117
  },
118
118
  ],
119
119
  },
@@ -123,7 +123,7 @@ describe("buildRestaurantSchema", () => {
123
123
  expect(schema).toEqual({
124
124
  "@context": "https://schema.org",
125
125
  "@type": "Restaurant",
126
- "@id": "https://www.pizzeria-lafattoria.de#restaurant",
126
+ "@id": "https://www.pizzeria-esempio.example#restaurant",
127
127
  name: site.name,
128
128
  description: site.description,
129
129
  url: site.url,
@@ -133,9 +133,9 @@ describe("buildRestaurantSchema", () => {
133
133
  priceRange: "€€",
134
134
  address: {
135
135
  "@type": "PostalAddress",
136
- streetAddress: "Kantstr. 6",
137
- postalCode: "63179",
138
- addressLocality: "Obertshausen",
136
+ streetAddress: "Musterstr. 1",
137
+ postalCode: "12345",
138
+ addressLocality: "Musterstadt",
139
139
  addressCountry: "DE",
140
140
  },
141
141
  sameAs: ["https://maps.google.com/?cid=123"],
@@ -158,14 +158,14 @@ describe("buildRestaurantSchema", () => {
158
158
  ],
159
159
  hasMenu: {
160
160
  "@type": "Menu",
161
- "@id": "https://www.pizzeria-lafattoria.de#menu",
161
+ "@id": "https://www.pizzeria-esempio.example#menu",
162
162
  name: "Speisekarte",
163
- url: "https://www.pizzeria-lafattoria.de/speisekarte",
163
+ url: "https://www.pizzeria-esempio.example/speisekarte",
164
164
  hasMenuSection: [
165
165
  {
166
166
  "@type": "MenuSection",
167
167
  name: "Pizza",
168
- url: "https://www.pizzeria-lafattoria.de/c/Pizza/",
168
+ url: "https://www.pizzeria-esempio.example/c/Pizza/",
169
169
  },
170
170
  {
171
171
  "@type": "MenuSection",
@@ -174,7 +174,7 @@ describe("buildRestaurantSchema", () => {
174
174
  {
175
175
  "@type": "MenuSection",
176
176
  name: "Spaghetti",
177
- url: "https://www.pizzeria-lafattoria.de/c/Nudeln/Spaghetti/",
177
+ url: "https://www.pizzeria-esempio.example/c/Nudeln/Spaghetti/",
178
178
  },
179
179
  ],
180
180
  },
@@ -187,19 +187,19 @@ describe("buildRestaurantSchema", () => {
187
187
  const schema = buildRestaurantSchema({
188
188
  site: {
189
189
  ...site,
190
- deliveryAreas: ["63179 Obertshausen", "63165 Lämmerspiel"],
190
+ deliveryAreas: ["12345 Musterstadt", "12346 Beispieldorf"],
191
191
  // strings: env values that are not plain numbers
192
192
  geo: { latitude: "50.0716", longitude: 8.8483 },
193
193
  acceptsReservations: "Nur telefonisch",
194
194
  },
195
- orderUrl: "https://www.pizzeria-lafattoria.de/speisekarte",
195
+ orderUrl: "https://www.pizzeria-esempio.example/speisekarte",
196
196
  paymentMethods: ["Barzahlung", "EC-Karte"],
197
197
  currency: "EUR",
198
198
  });
199
199
 
200
200
  expect(schema).toMatchObject({
201
201
  geo: { "@type": "GeoCoordinates", latitude: 50.0716, longitude: 8.8483 },
202
- areaServed: ["63179 Obertshausen", "63165 Lämmerspiel"],
202
+ areaServed: ["12345 Musterstadt", "12346 Beispieldorf"],
203
203
  acceptsReservations: "Nur telefonisch",
204
204
  paymentAccepted: "Barzahlung, EC-Karte",
205
205
  currenciesAccepted: "EUR",
@@ -207,7 +207,7 @@ describe("buildRestaurantSchema", () => {
207
207
  "@type": "OrderAction",
208
208
  target: {
209
209
  "@type": "EntryPoint",
210
- urlTemplate: "https://www.pizzeria-lafattoria.de/speisekarte",
210
+ urlTemplate: "https://www.pizzeria-esempio.example/speisekarte",
211
211
  actionPlatform: [
212
212
  "https://schema.org/DesktopWebPlatform",
213
213
  "https://schema.org/MobileWebPlatform",
@@ -246,16 +246,13 @@ describe("buildRestaurantSchema", () => {
246
246
  it("lists other names of the shop as alternateName", () => {
247
247
  const schema = buildRestaurantSchema({
248
248
  site: {
249
- name: "Pizzeria La Fattoria",
250
- url: "https://www.pizzeria-lafattoria.de",
251
- alternateNames: ["La Fattoria / Alte Schmiede", "Alte Schmiede"],
249
+ name: "Pizzeria Esempio",
250
+ url: "https://www.pizzeria-esempio.example",
251
+ alternateNames: ["Esempio / Alter Hof", "Alter Hof"],
252
252
  },
253
253
  });
254
254
 
255
- expect(schema.alternateName).toEqual([
256
- "La Fattoria / Alte Schmiede",
257
- "Alte Schmiede",
258
- ]);
255
+ expect(schema.alternateName).toEqual(["Esempio / Alter Hof", "Alter Hof"]);
259
256
  });
260
257
 
261
258
  it("leaves empty values out", () => {
@@ -365,7 +362,7 @@ describe("buildFaqPageSchema", () => {
365
362
  it("maps questions and answers", () => {
366
363
  expect(
367
364
  buildFaqPageSchema([
368
- { question: "Wohin liefern Sie?", answer: "Nach Obertshausen." },
365
+ { question: "Wohin liefern Sie?", answer: "Nach Musterstadt." },
369
366
  ]),
370
367
  ).toEqual({
371
368
  "@context": "https://schema.org",
@@ -374,7 +371,7 @@ describe("buildFaqPageSchema", () => {
374
371
  {
375
372
  "@type": "Question",
376
373
  name: "Wohin liefern Sie?",
377
- acceptedAnswer: { "@type": "Answer", text: "Nach Obertshausen." },
374
+ acceptedAnswer: { "@type": "Answer", text: "Nach Musterstadt." },
378
375
  },
379
376
  ],
380
377
  });