@easy-web/core 1.3.3 → 1.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 (43) hide show
  1. package/LICENSE +21 -0
  2. package/package.json +9 -9
  3. package/src/components/Header.astro +205 -205
  4. package/src/components/HeaderCentered.astro +230 -230
  5. package/src/components/HeaderFlyout.astro +370 -370
  6. package/src/components/HeaderHideOnScroll.astro +234 -234
  7. package/src/components/LanguageSwitch.astro +82 -82
  8. package/src/components/NotFound.astro +115 -115
  9. package/src/components/PageShell.astro +82 -82
  10. package/src/components/SeoHead.astro +106 -106
  11. package/src/components/StructuredData.astro +1 -1
  12. package/src/components/ThemeToggle.astro +84 -84
  13. package/src/components/UniversalMedia.astro +106 -106
  14. package/src/components/__tests__/StructuredData.test.ts +1 -1
  15. package/src/components/__tests__/UniversalMedia.test.ts +65 -65
  16. package/src/contracts/__tests__/jsonld.test.ts +1 -1
  17. package/src/contracts/index.ts +1 -1
  18. package/src/contracts/jsonld.ts +1 -1
  19. package/src/i18n/__tests__/factory.test.ts +54 -54
  20. package/src/i18n/__tests__/localized-paths.test.ts +258 -258
  21. package/src/i18n/__tests__/routing-multi-locale.test.ts +89 -89
  22. package/src/i18n/__tests__/seo.test.ts +140 -140
  23. package/src/i18n/factory.ts +66 -66
  24. package/src/i18n/index.ts +5 -5
  25. package/src/i18n/localized-paths.ts +181 -181
  26. package/src/i18n/seo.ts +131 -131
  27. package/src/markdown/__tests__/__fixtures__/abs-src-assets.md +1 -1
  28. package/src/markdown/__tests__/__fixtures__/external-url.md +1 -1
  29. package/src/markdown/__tests__/__fixtures__/public-slash.md +1 -1
  30. package/src/markdown/__tests__/__fixtures__/rel-double-dot.md +1 -1
  31. package/src/markdown/__tests__/index.test.ts +60 -60
  32. package/src/markdown/index.ts +1 -1
  33. package/src/markdown/plugin.ts +42 -42
  34. package/src/schemas/__tests__/notFound.test.ts +32 -32
  35. package/src/schemas/notFound.ts +33 -33
  36. package/src/seo/__tests__/crawl-policy.test.ts +50 -50
  37. package/src/seo/__tests__/integration.test.ts +195 -195
  38. package/src/seo/__tests__/no-index-resolution.test.ts +53 -53
  39. package/src/seo/__tests__/robots-txt.test.ts +66 -66
  40. package/src/seo/__tests__/sitemap-options.test.ts +400 -400
  41. package/src/seo/crawl-policy.ts +36 -36
  42. package/src/seo/index.ts +254 -254
  43. package/src/seo/routes/robots-txt.ts +36 -36
@@ -1,258 +1,258 @@
1
- import { describe, it, expect } from 'vitest'
2
- import { createI18n } from '../factory.js'
3
- import {
4
- findLocalizedGroup,
5
- normalizeLocalizedPath,
6
- validateLocalizedPaths,
7
- } from '../localized-paths.js'
8
- import { getAlternateLinks } from '../seo.js'
9
-
10
- const BASE = 'https://harleyrentflorida.de'
11
- const LOCALES = ['de', 'en'] as const
12
- const GROUPS = [{ de: '/datenschutz/', en: '/en/privacy/' }]
13
-
14
- const alternates = (path: string) =>
15
- getAlternateLinks({
16
- path,
17
- locales: LOCALES,
18
- defaultLocale: 'de',
19
- baseUrl: BASE,
20
- localizedPaths: GROUPS,
21
- })
22
-
23
- describe('normalizeLocalizedPath', () => {
24
- it.each([
25
- ['/datenschutz', '/datenschutz'],
26
- ['/datenschutz/', '/datenschutz'],
27
- ['/datenschutz///', '/datenschutz'],
28
- ['/datenschutz/?ref=x', '/datenschutz'],
29
- ['/datenschutz/#top', '/datenschutz'],
30
- ['datenschutz', '/datenschutz'],
31
- ['/', '/'],
32
- ['', '/'],
33
- ])('normalizes %s to %s', (input, expected) => {
34
- expect(normalizeLocalizedPath(input)).toBe(expected)
35
- })
36
- })
37
-
38
- describe('findLocalizedGroup', () => {
39
- it('matches regardless of trailing slash, because Astro and the sitemap disagree on it', () => {
40
- expect(findLocalizedGroup('/datenschutz', GROUPS)).toBe(GROUPS[0])
41
- expect(findLocalizedGroup('/datenschutz/', GROUPS)).toBe(GROUPS[0])
42
- expect(findLocalizedGroup('/en/privacy', GROUPS)).toBe(GROUPS[0])
43
- })
44
-
45
- it('returns undefined for equal-slug routes and for no groups', () => {
46
- expect(findLocalizedGroup('/impressum/', GROUPS)).toBeUndefined()
47
- expect(findLocalizedGroup('/datenschutz/', [])).toBeUndefined()
48
- expect(findLocalizedGroup('/datenschutz/', undefined)).toBeUndefined()
49
- })
50
- })
51
-
52
- describe('getAlternateLinks with translated slugs', () => {
53
- it('points the EN alternate of the DE privacy page at /en/privacy, not the non-existent /en/datenschutz', () => {
54
- const links = alternates('/datenschutz')
55
-
56
- expect(links).toEqual([
57
- { hreflang: 'de', href: `${BASE}/datenschutz/` },
58
- { hreflang: 'en', href: `${BASE}/en/privacy/` },
59
- { hreflang: 'x-default', href: `${BASE}/datenschutz/` },
60
- ])
61
- expect(links.some((l) => l.href.includes('/en/datenschutz'))).toBe(false)
62
- })
63
-
64
- it('emits an identical, reciprocal set from the EN side', () => {
65
- expect(alternates('/en/privacy')).toEqual(alternates('/datenschutz'))
66
- })
67
-
68
- it('emits the served URL form regardless of how the caller spelled the path', () => {
69
- for (const spelling of ['/datenschutz', '/datenschutz/']) {
70
- expect(alternates(spelling)).toEqual([
71
- { hreflang: 'de', href: `${BASE}/datenschutz/` },
72
- { hreflang: 'en', href: `${BASE}/en/privacy/` },
73
- { hreflang: 'x-default', href: `${BASE}/datenschutz/` },
74
- ])
75
- }
76
- })
77
-
78
- it('honours trailingSlash: never for translated slugs too', () => {
79
- const links = getAlternateLinks({
80
- path: '/datenschutz/',
81
- locales: LOCALES,
82
- defaultLocale: 'de',
83
- baseUrl: BASE,
84
- localizedPaths: GROUPS,
85
- trailingSlash: 'never',
86
- })
87
-
88
- expect(links).toEqual([
89
- { hreflang: 'de', href: `${BASE}/datenschutz` },
90
- { hreflang: 'en', href: `${BASE}/en/privacy` },
91
- { hreflang: 'x-default', href: `${BASE}/datenschutz` },
92
- ])
93
- })
94
-
95
- it('points x-default at the default-locale member of the group', () => {
96
- const xDefault = alternates('/en/privacy').find((l) => l.hreflang === 'x-default')
97
-
98
- expect(xDefault?.href).toBe(`${BASE}/datenschutz/`)
99
- })
100
-
101
- it('falls back to prefix derivation for equal-slug routes', () => {
102
- const links = alternates('/impressum')
103
-
104
- expect(links).toEqual([
105
- { hreflang: 'de', href: `${BASE}/impressum/` },
106
- { hreflang: 'en', href: `${BASE}/en/impressum/` },
107
- { hreflang: 'x-default', href: `${BASE}/impressum/` },
108
- ])
109
- })
110
-
111
- it('still derives by prefix when no localizedPaths are supplied', () => {
112
- const withoutGroups = getAlternateLinks({
113
- path: '/datenschutz',
114
- locales: LOCALES,
115
- defaultLocale: 'de',
116
- baseUrl: BASE,
117
- })
118
-
119
- expect(withoutGroups).toEqual([
120
- { hreflang: 'de', href: `${BASE}/datenschutz/` },
121
- { hreflang: 'en', href: `${BASE}/en/datenschutz/` },
122
- { hreflang: 'x-default', href: `${BASE}/datenschutz/` },
123
- ])
124
- })
125
-
126
- it('omits an untranslated locale rather than inventing a URL for it', () => {
127
- const links = getAlternateLinks({
128
- path: '/nur-deutsch',
129
- locales: LOCALES,
130
- defaultLocale: 'de',
131
- baseUrl: BASE,
132
- localizedPaths: [{ de: '/nur-deutsch/' }],
133
- })
134
-
135
- expect(links.map((l) => l.hreflang)).toEqual(['de', 'x-default'])
136
- })
137
- })
138
-
139
- describe('createI18n localizedPaths threading', () => {
140
- it('resolves translated slugs through the factory', () => {
141
- const i18n = createI18n({
142
- locales: LOCALES,
143
- defaultLocale: 'de',
144
- baseUrl: BASE,
145
- localizedPaths: GROUPS,
146
- })
147
-
148
- expect(i18n.getAlternateLinks('/datenschutz')).toEqual([
149
- { hreflang: 'de', href: `${BASE}/datenschutz/` },
150
- { hreflang: 'en', href: `${BASE}/en/privacy/` },
151
- { hreflang: 'x-default', href: `${BASE}/datenschutz/` },
152
- ])
153
- })
154
-
155
- it('keeps canonical and the self-referencing alternate identical for a translated slug', () => {
156
- const i18n = createI18n({
157
- locales: LOCALES,
158
- defaultLocale: 'de',
159
- baseUrl: BASE,
160
- localizedPaths: GROUPS,
161
- })
162
-
163
- const canonical = i18n.getCanonicalUrl('/datenschutz', 'de')
164
- const self = i18n.getAlternateLinks('/datenschutz').find((l) => l.hreflang === 'de')
165
-
166
- expect(self?.href).toBe(canonical)
167
- })
168
-
169
- it('threads trailingSlash through both SEO helpers', () => {
170
- const i18n = createI18n({
171
- locales: LOCALES,
172
- defaultLocale: 'de',
173
- baseUrl: BASE,
174
- localizedPaths: GROUPS,
175
- trailingSlash: 'never',
176
- })
177
-
178
- expect(i18n.getCanonicalUrl('/datenschutz/', 'de')).toBe(`${BASE}/datenschutz`)
179
- expect(i18n.getAlternateLinks('/datenschutz/').find((l) => l.hreflang === 'en')?.href).toBe(
180
- `${BASE}/en/privacy`,
181
- )
182
- })
183
-
184
- it('defaults localizedPaths to an empty list when omitted', () => {
185
- const i18n = createI18n({ locales: LOCALES, defaultLocale: 'de', baseUrl: BASE })
186
-
187
- expect(i18n.localizedPaths).toEqual([])
188
- expect(i18n.getAlternateLinks('/datenschutz')).toContainEqual({
189
- hreflang: 'en',
190
- href: `${BASE}/en/datenschutz/`,
191
- })
192
- })
193
-
194
- it('inherits the URL form resolved by @easy-web/seo when none is given', () => {
195
- const previous = process.env.EASY_WEB_SEO_TRAILING_SLASH
196
- process.env.EASY_WEB_SEO_TRAILING_SLASH = 'never'
197
-
198
- try {
199
- const i18n = createI18n({
200
- locales: LOCALES,
201
- defaultLocale: 'de',
202
- baseUrl: BASE,
203
- localizedPaths: GROUPS,
204
- })
205
-
206
- expect(i18n.trailingSlash).toBe('never')
207
- expect(i18n.getCanonicalUrl('/datenschutz', 'de')).toBe(`${BASE}/datenschutz`)
208
- expect(i18n.getAlternateLinks('/datenschutz')).toEqual([
209
- { hreflang: 'de', href: `${BASE}/datenschutz` },
210
- { hreflang: 'en', href: `${BASE}/en/privacy` },
211
- { hreflang: 'x-default', href: `${BASE}/datenschutz` },
212
- ])
213
- } finally {
214
- if (previous === undefined) delete process.env.EASY_WEB_SEO_TRAILING_SLASH
215
- else process.env.EASY_WEB_SEO_TRAILING_SLASH = previous
216
- }
217
- })
218
-
219
- it('lets an explicit trailingSlash outrank the inherited one', () => {
220
- const previous = process.env.EASY_WEB_SEO_TRAILING_SLASH
221
- process.env.EASY_WEB_SEO_TRAILING_SLASH = 'never'
222
-
223
- try {
224
- const i18n = createI18n({
225
- locales: LOCALES,
226
- defaultLocale: 'de',
227
- baseUrl: BASE,
228
- trailingSlash: 'always',
229
- })
230
-
231
- expect(i18n.trailingSlash).toBe('always')
232
- } finally {
233
- if (previous === undefined) delete process.env.EASY_WEB_SEO_TRAILING_SLASH
234
- else process.env.EASY_WEB_SEO_TRAILING_SLASH = previous
235
- }
236
- })
237
- })
238
-
239
- describe('validateLocalizedPaths', () => {
240
- it('accepts a complete group', () => {
241
- expect(validateLocalizedPaths(GROUPS, [...LOCALES])).toEqual([])
242
- })
243
-
244
- it('reports a missing locale', () => {
245
- expect(validateLocalizedPaths([{ de: '/datenschutz/' }], [...LOCALES])).toEqual([
246
- 'localizedPaths[0] is missing the locale(s): en.',
247
- ])
248
- })
249
-
250
- it('reports two locales in one group mapping to the same path', () => {
251
- const problems = validateLocalizedPaths(
252
- [{ de: '/privacy/', en: '/privacy' }],
253
- [...LOCALES],
254
- )
255
-
256
- expect(problems).toContain('localizedPaths[0] maps more than one locale to the same path: /privacy.')
257
- })
258
- })
1
+ import { describe, it, expect } from 'vitest'
2
+ import { createI18n } from '../factory.js'
3
+ import {
4
+ findLocalizedGroup,
5
+ normalizeLocalizedPath,
6
+ validateLocalizedPaths,
7
+ } from '../localized-paths.js'
8
+ import { getAlternateLinks } from '../seo.js'
9
+
10
+ const BASE = 'https://harleyrentflorida.de'
11
+ const LOCALES = ['de', 'en'] as const
12
+ const GROUPS = [{ de: '/datenschutz/', en: '/en/privacy/' }]
13
+
14
+ const alternates = (path: string) =>
15
+ getAlternateLinks({
16
+ path,
17
+ locales: LOCALES,
18
+ defaultLocale: 'de',
19
+ baseUrl: BASE,
20
+ localizedPaths: GROUPS,
21
+ })
22
+
23
+ describe('normalizeLocalizedPath', () => {
24
+ it.each([
25
+ ['/datenschutz', '/datenschutz'],
26
+ ['/datenschutz/', '/datenschutz'],
27
+ ['/datenschutz///', '/datenschutz'],
28
+ ['/datenschutz/?ref=x', '/datenschutz'],
29
+ ['/datenschutz/#top', '/datenschutz'],
30
+ ['datenschutz', '/datenschutz'],
31
+ ['/', '/'],
32
+ ['', '/'],
33
+ ])('normalizes %s to %s', (input, expected) => {
34
+ expect(normalizeLocalizedPath(input)).toBe(expected)
35
+ })
36
+ })
37
+
38
+ describe('findLocalizedGroup', () => {
39
+ it('matches regardless of trailing slash, because Astro and the sitemap disagree on it', () => {
40
+ expect(findLocalizedGroup('/datenschutz', GROUPS)).toBe(GROUPS[0])
41
+ expect(findLocalizedGroup('/datenschutz/', GROUPS)).toBe(GROUPS[0])
42
+ expect(findLocalizedGroup('/en/privacy', GROUPS)).toBe(GROUPS[0])
43
+ })
44
+
45
+ it('returns undefined for equal-slug routes and for no groups', () => {
46
+ expect(findLocalizedGroup('/impressum/', GROUPS)).toBeUndefined()
47
+ expect(findLocalizedGroup('/datenschutz/', [])).toBeUndefined()
48
+ expect(findLocalizedGroup('/datenschutz/', undefined)).toBeUndefined()
49
+ })
50
+ })
51
+
52
+ describe('getAlternateLinks with translated slugs', () => {
53
+ it('points the EN alternate of the DE privacy page at /en/privacy, not the non-existent /en/datenschutz', () => {
54
+ const links = alternates('/datenschutz')
55
+
56
+ expect(links).toEqual([
57
+ { hreflang: 'de', href: `${BASE}/datenschutz/` },
58
+ { hreflang: 'en', href: `${BASE}/en/privacy/` },
59
+ { hreflang: 'x-default', href: `${BASE}/datenschutz/` },
60
+ ])
61
+ expect(links.some((l) => l.href.includes('/en/datenschutz'))).toBe(false)
62
+ })
63
+
64
+ it('emits an identical, reciprocal set from the EN side', () => {
65
+ expect(alternates('/en/privacy')).toEqual(alternates('/datenschutz'))
66
+ })
67
+
68
+ it('emits the served URL form regardless of how the caller spelled the path', () => {
69
+ for (const spelling of ['/datenschutz', '/datenschutz/']) {
70
+ expect(alternates(spelling)).toEqual([
71
+ { hreflang: 'de', href: `${BASE}/datenschutz/` },
72
+ { hreflang: 'en', href: `${BASE}/en/privacy/` },
73
+ { hreflang: 'x-default', href: `${BASE}/datenschutz/` },
74
+ ])
75
+ }
76
+ })
77
+
78
+ it('honours trailingSlash: never for translated slugs too', () => {
79
+ const links = getAlternateLinks({
80
+ path: '/datenschutz/',
81
+ locales: LOCALES,
82
+ defaultLocale: 'de',
83
+ baseUrl: BASE,
84
+ localizedPaths: GROUPS,
85
+ trailingSlash: 'never',
86
+ })
87
+
88
+ expect(links).toEqual([
89
+ { hreflang: 'de', href: `${BASE}/datenschutz` },
90
+ { hreflang: 'en', href: `${BASE}/en/privacy` },
91
+ { hreflang: 'x-default', href: `${BASE}/datenschutz` },
92
+ ])
93
+ })
94
+
95
+ it('points x-default at the default-locale member of the group', () => {
96
+ const xDefault = alternates('/en/privacy').find((l) => l.hreflang === 'x-default')
97
+
98
+ expect(xDefault?.href).toBe(`${BASE}/datenschutz/`)
99
+ })
100
+
101
+ it('falls back to prefix derivation for equal-slug routes', () => {
102
+ const links = alternates('/impressum')
103
+
104
+ expect(links).toEqual([
105
+ { hreflang: 'de', href: `${BASE}/impressum/` },
106
+ { hreflang: 'en', href: `${BASE}/en/impressum/` },
107
+ { hreflang: 'x-default', href: `${BASE}/impressum/` },
108
+ ])
109
+ })
110
+
111
+ it('still derives by prefix when no localizedPaths are supplied', () => {
112
+ const withoutGroups = getAlternateLinks({
113
+ path: '/datenschutz',
114
+ locales: LOCALES,
115
+ defaultLocale: 'de',
116
+ baseUrl: BASE,
117
+ })
118
+
119
+ expect(withoutGroups).toEqual([
120
+ { hreflang: 'de', href: `${BASE}/datenschutz/` },
121
+ { hreflang: 'en', href: `${BASE}/en/datenschutz/` },
122
+ { hreflang: 'x-default', href: `${BASE}/datenschutz/` },
123
+ ])
124
+ })
125
+
126
+ it('omits an untranslated locale rather than inventing a URL for it', () => {
127
+ const links = getAlternateLinks({
128
+ path: '/nur-deutsch',
129
+ locales: LOCALES,
130
+ defaultLocale: 'de',
131
+ baseUrl: BASE,
132
+ localizedPaths: [{ de: '/nur-deutsch/' }],
133
+ })
134
+
135
+ expect(links.map((l) => l.hreflang)).toEqual(['de', 'x-default'])
136
+ })
137
+ })
138
+
139
+ describe('createI18n localizedPaths threading', () => {
140
+ it('resolves translated slugs through the factory', () => {
141
+ const i18n = createI18n({
142
+ locales: LOCALES,
143
+ defaultLocale: 'de',
144
+ baseUrl: BASE,
145
+ localizedPaths: GROUPS,
146
+ })
147
+
148
+ expect(i18n.getAlternateLinks('/datenschutz')).toEqual([
149
+ { hreflang: 'de', href: `${BASE}/datenschutz/` },
150
+ { hreflang: 'en', href: `${BASE}/en/privacy/` },
151
+ { hreflang: 'x-default', href: `${BASE}/datenschutz/` },
152
+ ])
153
+ })
154
+
155
+ it('keeps canonical and the self-referencing alternate identical for a translated slug', () => {
156
+ const i18n = createI18n({
157
+ locales: LOCALES,
158
+ defaultLocale: 'de',
159
+ baseUrl: BASE,
160
+ localizedPaths: GROUPS,
161
+ })
162
+
163
+ const canonical = i18n.getCanonicalUrl('/datenschutz', 'de')
164
+ const self = i18n.getAlternateLinks('/datenschutz').find((l) => l.hreflang === 'de')
165
+
166
+ expect(self?.href).toBe(canonical)
167
+ })
168
+
169
+ it('threads trailingSlash through both SEO helpers', () => {
170
+ const i18n = createI18n({
171
+ locales: LOCALES,
172
+ defaultLocale: 'de',
173
+ baseUrl: BASE,
174
+ localizedPaths: GROUPS,
175
+ trailingSlash: 'never',
176
+ })
177
+
178
+ expect(i18n.getCanonicalUrl('/datenschutz/', 'de')).toBe(`${BASE}/datenschutz`)
179
+ expect(i18n.getAlternateLinks('/datenschutz/').find((l) => l.hreflang === 'en')?.href).toBe(
180
+ `${BASE}/en/privacy`,
181
+ )
182
+ })
183
+
184
+ it('defaults localizedPaths to an empty list when omitted', () => {
185
+ const i18n = createI18n({ locales: LOCALES, defaultLocale: 'de', baseUrl: BASE })
186
+
187
+ expect(i18n.localizedPaths).toEqual([])
188
+ expect(i18n.getAlternateLinks('/datenschutz')).toContainEqual({
189
+ hreflang: 'en',
190
+ href: `${BASE}/en/datenschutz/`,
191
+ })
192
+ })
193
+
194
+ it('inherits the URL form resolved by @easy-web/seo when none is given', () => {
195
+ const previous = process.env.EASY_WEB_SEO_TRAILING_SLASH
196
+ process.env.EASY_WEB_SEO_TRAILING_SLASH = 'never'
197
+
198
+ try {
199
+ const i18n = createI18n({
200
+ locales: LOCALES,
201
+ defaultLocale: 'de',
202
+ baseUrl: BASE,
203
+ localizedPaths: GROUPS,
204
+ })
205
+
206
+ expect(i18n.trailingSlash).toBe('never')
207
+ expect(i18n.getCanonicalUrl('/datenschutz', 'de')).toBe(`${BASE}/datenschutz`)
208
+ expect(i18n.getAlternateLinks('/datenschutz')).toEqual([
209
+ { hreflang: 'de', href: `${BASE}/datenschutz` },
210
+ { hreflang: 'en', href: `${BASE}/en/privacy` },
211
+ { hreflang: 'x-default', href: `${BASE}/datenschutz` },
212
+ ])
213
+ } finally {
214
+ if (previous === undefined) delete process.env.EASY_WEB_SEO_TRAILING_SLASH
215
+ else process.env.EASY_WEB_SEO_TRAILING_SLASH = previous
216
+ }
217
+ })
218
+
219
+ it('lets an explicit trailingSlash outrank the inherited one', () => {
220
+ const previous = process.env.EASY_WEB_SEO_TRAILING_SLASH
221
+ process.env.EASY_WEB_SEO_TRAILING_SLASH = 'never'
222
+
223
+ try {
224
+ const i18n = createI18n({
225
+ locales: LOCALES,
226
+ defaultLocale: 'de',
227
+ baseUrl: BASE,
228
+ trailingSlash: 'always',
229
+ })
230
+
231
+ expect(i18n.trailingSlash).toBe('always')
232
+ } finally {
233
+ if (previous === undefined) delete process.env.EASY_WEB_SEO_TRAILING_SLASH
234
+ else process.env.EASY_WEB_SEO_TRAILING_SLASH = previous
235
+ }
236
+ })
237
+ })
238
+
239
+ describe('validateLocalizedPaths', () => {
240
+ it('accepts a complete group', () => {
241
+ expect(validateLocalizedPaths(GROUPS, [...LOCALES])).toEqual([])
242
+ })
243
+
244
+ it('reports a missing locale', () => {
245
+ expect(validateLocalizedPaths([{ de: '/datenschutz/' }], [...LOCALES])).toEqual([
246
+ 'localizedPaths[0] is missing the locale(s): en.',
247
+ ])
248
+ })
249
+
250
+ it('reports two locales in one group mapping to the same path', () => {
251
+ const problems = validateLocalizedPaths(
252
+ [{ de: '/privacy/', en: '/privacy' }],
253
+ [...LOCALES],
254
+ )
255
+
256
+ expect(problems).toContain('localizedPaths[0] maps more than one locale to the same path: /privacy.')
257
+ })
258
+ })