feat(cms): hosting plans page with lifecycle gate and net + VAT prices (MITHOME-130)
CI Pipeline with Test Management / 🧪 Run Tests & Generate Reports (push) Canceled after 0s
Test Reporting & Gherkin Analysis / 🧪 Run Tests & Generate Reports (push) Canceled after 0s
CI Pipeline with Test Management / 🐳 Docker Integration Tests (push) Canceled after 0s
CI Pipeline with Test Management / 🏗️ Build Docker Image (push) Canceled after 0s
CI Pipeline with Test Management / 📊 Generate Test Summary (push) Canceled after 0s
Test Reporting & Gherkin Analysis / 📊 Analyze Test Coverage (push) Canceled after 0s
Test Reporting & Gherkin Analysis / 🔄 Sync with Linear (push) Canceled after 0s
Test Reporting & Gherkin Analysis / ⚡ Performance Monitoring (push) Canceled after 0s
CI Pipeline with Test Management / 🧪 Run Tests & Generate Reports (push) Canceled after 0s
Test Reporting & Gherkin Analysis / 🧪 Run Tests & Generate Reports (push) Canceled after 0s
CI Pipeline with Test Management / 🐳 Docker Integration Tests (push) Canceled after 0s
CI Pipeline with Test Management / 🏗️ Build Docker Image (push) Canceled after 0s
CI Pipeline with Test Management / 📊 Generate Test Summary (push) Canceled after 0s
Test Reporting & Gherkin Analysis / 📊 Analyze Test Coverage (push) Canceled after 0s
Test Reporting & Gherkin Analysis / 🔄 Sync with Linear (push) Canceled after 0s
Test Reporting & Gherkin Analysis / ⚡ Performance Monitoring (push) Canceled after 0s
- Products collection (interim mirror of the PLATFM-14 catalogue contract): lifecycle status, product type, required whole-forint net price, yearly billing, service definition, per-product English gate - HostingPlans global: page copy, comparison labels, VAT rate (27%) - Gate: production shows only active plans, staging all but retired; with no showable plan the page is 404 and left out of the menu and the sitemap - /hu/tarhely-csomagok <-> /en/hosting-plans via PAGE_SLUGS (hreflang, language switcher, CTA page picker) - Seed migration 20260929_hosting_plans: mIT Start (14 900 Ft/yr, 5 mailboxes) and mIT Mid (23 900 Ft/yr) as drafts, English AI draft; idempotent - Production SEO suite expects at least 12 sitemap URLs; new SMOKE-10 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
0c5888761b
commit
1e0742a548
@@ -0,0 +1,74 @@
|
||||
import { HOSTING_PLAN_SEEDS, productData, up } from '../migrations/20260929_hosting_plans'
|
||||
|
||||
type Doc = Record<string, unknown>
|
||||
|
||||
/** Minimal Local API stand-in: products by slug + one global. */
|
||||
function fakePayload(products: Doc[] = [], page: Doc = {}) {
|
||||
const payload = {
|
||||
find: jest.fn(async ({ where }: { where: { slug: { equals: string } } }) => ({
|
||||
docs: products.filter((p) => p.slug === where.slug.equals),
|
||||
})),
|
||||
create: jest.fn(async ({ data }: { data: Doc }) => {
|
||||
const doc = { id: `id-${products.length}`, ...data }
|
||||
products.push(doc)
|
||||
return doc
|
||||
}),
|
||||
update: jest.fn(async () => ({})),
|
||||
findGlobal: jest.fn(async () => page),
|
||||
updateGlobal: jest.fn(async ({ data, locale }: { data: Doc; locale: string }) => {
|
||||
if (locale === 'hu') Object.assign(page, data)
|
||||
return page
|
||||
}),
|
||||
logger: { info: jest.fn(), warn: jest.fn() },
|
||||
}
|
||||
return { payload, args: { payload, req: {} } as never }
|
||||
}
|
||||
|
||||
describe('20260929_hosting_plans migration (MITHOME-130)', () => {
|
||||
it('should seed the catalogue figures and prices as a draft, with an English AI draft', () => {
|
||||
const start = productData(HOSTING_PLAN_SEEDS[0], 'hu')
|
||||
expect(start).toMatchObject({
|
||||
slug: 'mit-start',
|
||||
productType: 'hosting',
|
||||
status: 'draft',
|
||||
enTranslationStatus: 'ai-draft',
|
||||
pricing: { netAmount: 14900, billingPeriod: 'yearly' },
|
||||
serviceDefinition: { storageGb: 3, mailStorageGb: 1, databases: 1, mailboxes: 5, ssl: true, spamFilter: true },
|
||||
_status: 'published',
|
||||
})
|
||||
expect(productData(HOSTING_PLAN_SEEDS[1], 'hu')).toMatchObject({
|
||||
highlighted: true,
|
||||
pricing: { netAmount: 23900 },
|
||||
serviceDefinition: { storageGb: 8, mailStorageGb: 4, domainAliases: 2, databases: 2, mailboxes: 10 },
|
||||
})
|
||||
})
|
||||
|
||||
it('should write only localized fields in English', () => {
|
||||
const en = productData(HOSTING_PLAN_SEEDS[0], 'en')
|
||||
expect(Object.keys(en).sort()).toEqual(['_status', 'public', 'serviceDefinition'])
|
||||
expect(en.serviceDefinition).toEqual({ backup: 'Daily, with 7-day restore' })
|
||||
})
|
||||
|
||||
it('should create the missing products and page copy once', async () => {
|
||||
const products: Doc[] = []
|
||||
const { args, payload } = fakePayload(products)
|
||||
await up(args)
|
||||
expect(payload.create).toHaveBeenCalledTimes(2)
|
||||
expect(payload.update).toHaveBeenCalledWith(expect.objectContaining({ locale: 'en' }))
|
||||
expect(payload.updateGlobal).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ locale: 'hu', data: expect.objectContaining({ vatRatePercent: 27, hero: expect.objectContaining({ title: 'Tárhelycsomagok' }) }) }),
|
||||
)
|
||||
expect(payload.logger.info).toHaveBeenLastCalledWith('MITHOME-130 hosting plans: 2 product(s) created, 1 page copy seeded')
|
||||
|
||||
await up(args)
|
||||
expect(payload.create).toHaveBeenCalledTimes(2)
|
||||
expect(payload.logger.info).toHaveBeenLastCalledWith('MITHOME-130 hosting plans: 0 product(s) created, 0 page copy seeded')
|
||||
})
|
||||
|
||||
it('should not overwrite an existing product or edited page copy', async () => {
|
||||
const { args, payload } = fakePayload([{ id: 'x', slug: 'mit-start', pricing: { netAmount: 1 } }], { hero: { title: 'Saját cím' } })
|
||||
await up(args)
|
||||
expect(payload.create).toHaveBeenCalledTimes(1)
|
||||
expect(payload.updateGlobal).not.toHaveBeenCalled()
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user