feat(cms): partner categories, publication permission and CMS-managed references copy (MITHOME-131)
Per the managed web operations research (PLATFM-13), a client must not be
shown as a "partner" and names/logos need written permission. Partners
now carry a required relationship category and a publication permission
(default: none) with the permission's location and review date; only
entries with written permission, a category and a logo are public.
The homepage shows clients ("Akik már minket választottak") and other
relationships in separate blocks via ReferencesSection; every partner
shows its relationship type. The section copy moved from a hard-coded
constant into the Home global (localized). The 20260929_partner_references
migration marks Angele Pihenőház as a client reference with written
permission (owner-confirmed), hides any other uncategorised entry, and
seeds the copy in hu + en. The JSON seed uses the same source.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
526f413bfd
commit
5f9a53ed18
@@ -0,0 +1,46 @@
|
||||
import { classifyPartner, seedReferencesSection, up } from '../migrations/20260929_partner_references'
|
||||
import { fakeArgs, fakeCollection } from './helpers/fake-mongo'
|
||||
|
||||
type Doc = Record<string, unknown>
|
||||
|
||||
describe('20260929_partner_references migration (MITHOME-131)', () => {
|
||||
it('should mark the confirmed client as a client reference with written permission', () => {
|
||||
const doc: Doc = { name: 'Angele Pihenőház', url: 'https://angelepihenohaz.hu' }
|
||||
expect(classifyPartner(doc)).toBe(1)
|
||||
expect(doc).toMatchObject({ relationship: 'client-reference', publicationPermission: 'granted' })
|
||||
expect(doc.permissionReference).toMatch(/Írásos engedély/)
|
||||
})
|
||||
|
||||
it('should hide any other uncategorised entry until someone classifies it', () => {
|
||||
const doc: Doc = { name: 'Ismeretlen Kft.' }
|
||||
classifyPartner(doc)
|
||||
expect(doc).toEqual({ name: 'Ismeretlen Kft.', publicationPermission: 'none' })
|
||||
})
|
||||
|
||||
it('should not touch an already categorised entry', () => {
|
||||
const doc: Doc = { name: 'Angele Pihenőház', relationship: 'supplier', publicationPermission: 'pending' }
|
||||
expect(classifyPartner(doc)).toBe(0)
|
||||
expect(doc.relationship).toBe('supplier')
|
||||
})
|
||||
|
||||
it('should seed the section copy in both languages only when missing', () => {
|
||||
const doc: Doc = {}
|
||||
seedReferencesSection(doc)
|
||||
expect(doc.referencesSection).toMatchObject({
|
||||
clientsTitle: { hu: 'Akik már minket választottak', en: 'Clients who chose us' },
|
||||
relationshipLabels: { infrastructure: { hu: 'Technológiai háttér', en: 'Infrastructure provider' } },
|
||||
})
|
||||
const edited: Doc = { referencesSection: { clientsTitle: { hu: 'Saját cím' } } }
|
||||
expect(seedReferencesSection(edited)).toBe(0)
|
||||
})
|
||||
|
||||
it('should update the partners collection and the home global, idempotently', async () => {
|
||||
const partners = fakeCollection([{ _id: 'p1', name: 'Angele Pihenőház' }])
|
||||
const globals = fakeCollection([{ _id: 'h', globalType: 'home' }])
|
||||
const { args, payload } = fakeArgs({ globals, collections: { partners } })
|
||||
await up(args)
|
||||
expect(payload.logger.info).toHaveBeenLastCalledWith('MITHOME-131 references: 1 partner record(s) classified, 1 home record(s) seeded')
|
||||
await up(args)
|
||||
expect(payload.logger.info).toHaveBeenLastCalledWith('MITHOME-131 references: 0 partner record(s) classified, 0 home record(s) seeded')
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user