Analyse: Zielgruppen-Bestätigung in Historie, Rücknahme bei Fehler nach Dokument-Update, handelnde Person mit Name und E-Mail

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ClaudeandClaude Opus 5.5 committed 2026-10-01 18:50:36 +00:00
1 parent 3d05472b25
commit f401dc14d7
7 files changed
+108 -56

No files matched your search

+13 -10
View File
@@ -30,8 +30,8 @@ function mockClient({ attrs = [], consentsExist = false, consentAttrs = [], inde
}
}
test('Schema: 12 Attribute mit Groessen, alle optional', () => {
const sizes = Object.fromEntries(ANALYSE_ATTRIBUTES.map((a) => [a.key, a.size]))
test('Schema: 14 Attribute mit Groessen, alle optional', () => {
const sizes = Object.fromEntries(ANALYSE_ATTRIBUTES.filter((a) => a.type === 'string').map((a) => [a.key, a.size]))
assert.deepEqual(sizes, {
accentColor: 7,
avvVersion: 20,
@@ -45,30 +45,33 @@ test('Schema: 12 Attribute mit Groessen, alle optional', () => {
avvConsentChannel: 10,
removalTicketId: 40,
publishTicketId: 40,
audienceTextVersion: 20,
})
assert.equal(ANALYSE_ATTRIBUTES.length, 12)
assert.ok(ANALYSE_ATTRIBUTES.every((a) => a.required === false && a.type === 'string'))
assert.equal(ANALYSE_ATTRIBUTES.length, 14)
assert.equal(ANALYSE_ATTRIBUTES.find((a) => a.key === 'audienceConfirmed').type, 'boolean')
assert.ok(ANALYSE_ATTRIBUTES.every((a) => a.required === false))
})
test('Schema: Historien-Collection analyseConsents', () => {
assert.equal(config.collections.analyseConsents, 'analyseConsents')
const sizes = Object.fromEntries(CONSENT_ATTRIBUTES.map((a) => [a.key, a.size]))
const sizes = Object.fromEntries(CONSENT_ATTRIBUTES.filter((a) => a.type === 'string').map((a) => [a.key, a.size]))
assert.deepEqual(sizes, {
customerId: 36, projectId: 36, siteKey: 40, event: 8, avvVersion: 20, via: 8,
acceptedAt: 40, acceptedBy: 100, textformDate: 10, textformChannel: 10,
acceptedAt: 40, acceptedBy: 100, textformDate: 10, textformChannel: 10, audienceTextVersion: 20,
})
assert.equal(CONSENT_ATTRIBUTES.find((a) => a.key === 'audienceConfirmed').type, 'boolean')
assert.deepEqual(CONSENT_INDEXES.map((i) => i.attributes), [['projectId']])
})
test('main legt nur fehlende Attribute an und die fehlende Collection samt Index', async () => {
const client = mockClient({ attrs: ['accentColor'] })
const result = await main({ client, log: () => {} })
assert.equal(client.calls.attrs.filter((k) => k.startsWith('portalFeatures.')).length, 11)
assert.equal(client.calls.attrs.filter((k) => k.startsWith('portalFeatures.')).length, 13)
assert.ok(!client.calls.attrs.includes('portalFeatures.accentColor'))
assert.equal(client.calls.attrs.filter((k) => k.startsWith('analyseConsents.')).length, 10)
assert.equal(client.calls.attrs.filter((k) => k.startsWith('analyseConsents.')).length, 12)
assert.deepEqual(client.calls.collections, [{ id: 'analyseConsents', name: 'analyseConsents' }])
assert.deepEqual(client.calls.indexes, ['analyseConsents.projectId_idx'])
assert.equal(result.missing.length, 21)
assert.equal(result.missing.length, 25)
})
test('main ueberspringt vorhandene Collection, Attribute und Index', async () => {
@@ -87,7 +90,7 @@ test('main --check legt nichts an und meldet missing', async () => {
const client = mockClient({ attrs: ['accentColor'] })
const result = await main({ check: true, client, log: () => {} })
assert.deepEqual(client.calls, { attrs: [], collections: [], indexes: [] })
assert.equal(result.missing.length, 21)
assert.equal(result.missing.length, 25)
assert.equal(result.missingCollection, true)
})