8aab968e09
Build & Deploy / Build & Push Docker Image (push) Successful in 1m2s
Test / Type Check (all packages) (push) Failing after 28s
Test / API Unit Tests (push) Has been skipped
Test / Homepage Unit Tests (push) Has been skipped
Test / Storefront Unit Tests (push) Has been skipped
Test / Admin Unit Tests (push) Has been skipped
Test / Dashboard Unit Tests (push) Has been skipped
Test / API Integration Tests (push) Has been skipped
Build & Deploy / Deploy to VPS (push) Successful in 3s
Comprehensive rename of all marketplace references to storefront: - API module: apps/api/src/modules/marketplace/ → storefront/ - Components: MarketplaceHeader → StorefrontHeader, MarketplaceShell → StorefrontShell, MarketplaceFooter → StorefrontFooter - Types: marketplace-homepage.ts → storefront-homepage.ts - Test files: employee-marketplace-* → employee-storefront-* - All source code identifiers, imports, route paths, and strings - Documentation (docs/), CI config (.gitlab-ci.yml), scripts - Dashboard, admin, storefront workspace references - Prisma field names preserved (isListedOnMarketplace, marketplaceRating, marketplaceFunnelEvent) as they map to database schema Validation: - API type-check: 0 errors - Storefront type-check: 0 errors - Dashboard type-check: 0 errors - Full monorepo type-check: only pre-existing admin TS18046
42 lines
1.3 KiB
TypeScript
42 lines
1.3 KiB
TypeScript
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
|
|
|
const cookieValues = vi.hoisted(() => new Map<string, string>())
|
|
|
|
vi.mock('next/headers', () => ({
|
|
cookies: async () => ({
|
|
get: (name: string) => {
|
|
const value = cookieValues.get(name)
|
|
return value === undefined ? undefined : { value }
|
|
},
|
|
}),
|
|
}))
|
|
|
|
import { getStorefrontLanguage } from './i18n.server'
|
|
import { MARKETPLACE_LANGUAGE_COOKIE, SHARED_LANGUAGE_COOKIE } from './i18n'
|
|
|
|
describe('getStorefrontLanguage', () => {
|
|
beforeEach(() => {
|
|
cookieValues.clear()
|
|
})
|
|
|
|
it('prefers the shared language cookie over the legacy storefront cookie', async () => {
|
|
cookieValues.set(SHARED_LANGUAGE_COOKIE, 'ar')
|
|
cookieValues.set(MARKETPLACE_LANGUAGE_COOKIE, 'fr')
|
|
|
|
await expect(getStorefrontLanguage()).resolves.toBe('ar')
|
|
})
|
|
|
|
it('falls back to the legacy storefront cookie during migration', async () => {
|
|
cookieValues.set(MARKETPLACE_LANGUAGE_COOKIE, 'fr')
|
|
|
|
await expect(getStorefrontLanguage()).resolves.toBe('fr')
|
|
})
|
|
|
|
it('defaults to English when cookies are absent or invalid', async () => {
|
|
await expect(getStorefrontLanguage()).resolves.toBe('en')
|
|
cookieValues.set(SHARED_LANGUAGE_COOKIE, 'es')
|
|
|
|
await expect(getStorefrontLanguage()).resolves.toBe('en')
|
|
})
|
|
})
|