1 import { describe, expect, it } from "vitest"
2 import { LOCALES, MARKETS } from "../config/markets"
3 import { PREVIEW_PRODUCTS, previewProductsForMarket } from "./products"
4
5 describe("public storefront demonstration catalogue", () => {
6 it("provides examples for all five markets", () => {
7 for (const market of Object.keys(MARKETS) as Array<keyof typeof MARKETS>) {
8 expect(previewProductsForMarket(market).length).toBeGreaterThan(0)
9 }
10 })
11 it("limits electronics examples to the Iranian market", () => {
12 expect(previewProductsForMarket("IR").some((p) => p.kind === "electronics")).toBe(true)
13 for (const market of ["AE", "OM", "IQ", "QA"] as const) {
14 expect(previewProductsForMarket(market).every((p) => p.kind === "iranian")).toBe(true)
15 }
16 })
17 it("has complete, nonempty translations and unique sample IDs", () => {
18 expect(new Set(PREVIEW_PRODUCTS.map((p) => p.id)).size).toBe(PREVIEW_PRODUCTS.length)
19 for (const product of PREVIEW_PRODUCTS) {
20 for (const locale of Object.keys(LOCALES) as Array<keyof typeof LOCALES>) {
21 expect(product.name[locale].trim()).not.toBe("")
22 expect(product.description[locale].trim()).not.toBe("")
23 }
24 }
25 })
26 it("has no imaginary price or inventory fields", () => {
27 for (const p of PREVIEW_PRODUCTS) {
28 expect("price" in p).toBe(false)
29 expect("inventory" in p).toBe(false)
30 expect("available" in p).toBe(false)
31 }
32 })
33 })