Files
ipal-kit/test/openingHours.test.ts
radoslaw.smolinskiandClaude Opus 5.5 c9a50abc33 SEO/GEO tools and project requests: site index, IndexNow, page JSON-LD, fixes
GEO / SEO
- collectSiteIndex: one list of public docs per locale (pages + archive
  entries) on sitemap rules; llms.txt/llms-full and MCP list_pages now include
  blog/content entries and every language. Fixes hard-coded "## Strony" heading
  and homepage not collapsing to the locale root in llms.txt.
- Markdown frontmatter: canonical url + updated date.
- Metadata: X/Twitter card, OG image width/height/alt, og:type article with
  published/modified times for entries.
- Fix: Site Settings "defaultShareImage" was never used — now the OG fallback.
- getPageJsonLd (createContentHelpers): WebPage/CollectionPage/BlogPosting,
  BreadcrumbList from the real route, FAQPage via a project mapper.
- IndexNow (opt-in ipalKit({ indexNow: true })): submit published URLs in all
  languages, key generated in Site Integrations or INDEXNOW_KEY, key route.
- sameAs profiles in Site Settings + sameAsUrls(); sitemap <image:image>.

From project reports
- Fix: package exports were missing ./env and ./fluid.css although the docs
  import them (TS2307); regression test checks every documented subpath.
- Fix: plugins run before Payload adds its default users collection, so roles
  and 2FA had nothing to attach to — ipalKit injects an auth collection when
  the project has none (project's own one wins). Audit no longer errors on it.
- createMarkdownRoute, createSubmitAction (/server, headers injected).
- formatOpeningHours (PL/EN/DE text → schema.org), used by
  buildLocalBusinessJsonLd, which also takes a schema.org `type`.
- buildNavigationJsonLd straight from the header global.
- buildCsp googleMaps: full Maps JS API domain set; values de-duplicated.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-16 02:19:08 +02:00

31 lines
1.6 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { describe, expect, test } from 'vitest'
import { formatOpeningHours } from '../src/modules/seo/formatOpeningHours.js'
describe('formatOpeningHours', () => {
test.each([
['Pn-Pt: 08:00 - 17:00, Sob: 08:00 - 14:00', ['Mo-Fr 08:00-17:00', 'Sa 08:00-14:00']],
['Pn–Pt 8–17, Sob: 8-14, Nd: nieczynne', ['Mo-Fr 08:00-17:00', 'Sa 08:00-14:00']],
['Poniedziałek - Piątek: 9.30 - 17.30\nSobota: 10-14\nNiedziela: zamknięte', ['Mo-Fr 09:30-17:30', 'Sa 10:00-14:00']],
['Pn do Pt 8:00 do 16:00', ['Mo-Fr 08:00-16:00']],
['Sob: nieczynne, Nd 10-14', ['Su 10:00-14:00']],
['Pn, Śr, Pt 9-17', ['Mo,We,Fr 09:00-17:00']],
['Mon–Fri 9am... no: 9:00-18:00; Sat 10:00 to 15:00', ['Mo-Fr 09:00-18:00', 'Sa 10:00-15:00']],
['Mo–Fr 8–16 Uhr; Sa 9–12; So geschlossen', ['Mo-Fr 08:00-16:00', 'Sa 09:00-12:00']],
['Do 10-18', ['Th 10:00-18:00']],
['całodobowo', ['Mo-Su 00:00-23:59']],
['24/7', ['Mo-Su 00:00-23:59']],
['Pn-Pt 8-24', ['Mo-Fr 08:00-23:59']],
])('%s', (input, expected) => {
expect(formatOpeningHours(input)).toEqual(expected)
})
test('schema.org strings and arrays pass through; junk is dropped', () => {
expect(formatOpeningHours(['Mo-Fr 08:00-17:00', 'Sa 09:00-13:00'])).toEqual(['Mo-Fr 08:00-17:00', 'Sa 09:00-13:00'])
expect(formatOpeningHours(['Pn-Pt 8-16', 'Sa 09:00-13:00'])).toEqual(['Mo-Fr 08:00-16:00', 'Sa 09:00-13:00'])
expect(formatOpeningHours('zadzwoń, umówimy się')).toEqual([])
expect(formatOpeningHours('Pn-Pt 25-30')).toEqual([])
expect(formatOpeningHours(undefined)).toEqual([])
})
})