@faststore/core 4.9.1-dev.0 → 4.9.2

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.
@@ -1,14 +1,17 @@
1
1
  import { ProductJsonLd } from 'next-seo'
2
2
  import { renderToStaticMarkup } from 'react-dom/server'
3
3
  import { describe, expect, it } from 'vitest'
4
- import { toProductJsonLdOffer } from '../../src/utils/productJsonLd'
4
+ import {
5
+ toProductJsonLdIdentifiers,
6
+ toProductJsonLdOffer,
7
+ } from '../../src/utils/productJsonLd'
5
8
 
6
9
  /**
7
10
  * Pins the next-seo behaviour the PDP's JSON-LD depends on.
8
11
  *
9
- * `p.tsx` omits `mpn`, `gtin` and `releaseDate` by conditional spread rather
10
- * than passing empty strings, and drops `seller` from the offer allowlist. Both
11
- * choices only work because of how next-seo builds the script — it forwards
12
+ * `p.tsx` omits empty `mpn`, `gtin` and `releaseDate` (via
13
+ * `toProductJsonLdIdentifiers`) rather than passing empty strings, and drops
14
+ * `seller` from the offer allowlist. Both choices only work because of how next-seo builds the script — it forwards
12
15
  * unknown props untouched (so `""` would be published) and turns any truthy
13
16
  * `seller` into an `Organization`, even when it has no name. A next-seo upgrade
14
17
  * that changed either would silently reintroduce the defects from ticket
@@ -71,4 +74,21 @@ describe('next-seo ProductJsonLd contract', () => {
71
74
  url: 'https://store.example/p',
72
75
  })
73
76
  })
77
+
78
+ // `p.tsx` spreads `toProductJsonLdIdentifiers(product)` into ProductJsonLd,
79
+ // and `StoreProduct.releaseDate` is the raw upstream epoch. This pins what
80
+ // actually lands in the published script for that input.
81
+ it('publishes an epoch releaseDate as an ISO calendar date', () => {
82
+ const jsonLd = renderJsonLd(
83
+ toProductJsonLdIdentifiers({
84
+ gtin: '',
85
+ mpn: '',
86
+ releaseDate: '1774224000000',
87
+ })
88
+ )
89
+
90
+ expect(jsonLd.releaseDate).toBe('2026-03-23')
91
+ expect(jsonLd).not.toHaveProperty('gtin')
92
+ expect(jsonLd).not.toHaveProperty('mpn')
93
+ })
74
94
  })