Analyse-Tests: feste Zeiten vor NOW statt echter Uhr (Reihenfolge kippte ab 2026-10-05 10:00 UTC)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9350fccd77
commit
348ddc927c
1 file changed
+7
-5
@@ -356,7 +356,8 @@ test('Kunde ohne actor-Namen oder Mitarbeiter ohne Textform: 400', async () => {
|
||||
|
||||
test('Historie: Kunde, Aus, An durch Mitarbeiter in zeitlicher Folge; Portal-Dokument gleich', async () => {
|
||||
aw.seed('websiteProjects', { $id: 'p14', customerId: 'c1', projectName: 'Historie', subdomain: 'historie', isPublic: true })
|
||||
const { doc: d1 } = await an.activateAnalyse({ customerId: 'c1', projectId: 'p14', ...cust() })
|
||||
// feste Zeiten vor NOW: mit der echten Uhr kippt die Reihenfolge, sobald die Uhr NOW überholt
|
||||
const { doc: d1 } = await an.activateAnalyse({ customerId: 'c1', projectId: 'p14', ...cust({ now: new Date(NOW.getTime() - 60_000) }) })
|
||||
let h = await consents('p14')
|
||||
assert.equal(h.length, 1)
|
||||
assert.equal(h[0].event, 'on')
|
||||
@@ -375,8 +376,8 @@ test('Historie: Kunde, Aus, An durch Mitarbeiter in zeitlicher Folge; Portal-Dok
|
||||
assert.equal(d1.avvConsentDate, '')
|
||||
assert.equal(d1.avvConsentChannel, '')
|
||||
// Farbwechsel und erneutes Aktivieren: keine neue Zeile
|
||||
await an.activateAnalyse({ customerId: 'c1', projectId: 'p14', accentColor: '#222222', ...cust() })
|
||||
await an.activateAnalyse({ customerId: 'c1', projectId: 'p14', ...cust() })
|
||||
await an.activateAnalyse({ customerId: 'c1', projectId: 'p14', accentColor: '#222222', ...cust({ now: new Date(NOW.getTime() - 50_000) }) })
|
||||
await an.activateAnalyse({ customerId: 'c1', projectId: 'p14', ...cust({ now: new Date(NOW.getTime() - 40_000) }) })
|
||||
assert.equal((await consents('p14')).length, 1)
|
||||
// Marker zurücksetzen beim Wiedereinschalten
|
||||
await updateDocument(config.collections.portalFeatures, d1.$id, { removalTicketId: 'r1', publishTicketId: 'u1' })
|
||||
@@ -418,14 +419,15 @@ test('recordConsent scheitert: putSite wird zurückgenommen, Dokument bleibt aus
|
||||
|
||||
test('Ausschalten schreibt off-Historie; Fehler dort verhindert das Ausschalten nicht', async () => {
|
||||
aw.seed('websiteProjects', { $id: 'p16', customerId: 'c1', projectName: 'Aus', subdomain: 'aus', isPublic: true })
|
||||
await an.activateAnalyse({ customerId: 'c1', projectId: 'p16', ...cust() })
|
||||
// feste Zeiten vor NOW (siehe Historie-Test)
|
||||
await an.activateAnalyse({ customerId: 'c1', projectId: 'p16', ...cust({ now: new Date(NOW.getTime() - 120_000) }) })
|
||||
const prev = an.analyseDeps.recordConsent
|
||||
an.analyseDeps.recordConsent = async () => { throw new Error('Historie weg') }
|
||||
const r = await an.deactivateAnalyse({ customerId: 'c1', projectId: 'p16', now: NOW, actor })
|
||||
an.analyseDeps.recordConsent = prev
|
||||
assert.equal(r.doc.state, 'off')
|
||||
assert.deepEqual((await consents('p16')).map((x) => x.event), ['on'])
|
||||
await an.activateAnalyse({ customerId: 'c1', projectId: 'p16', ...cust() })
|
||||
await an.activateAnalyse({ customerId: 'c1', projectId: 'p16', ...cust({ now: new Date(NOW.getTime() - 60_000) }) })
|
||||
await an.deactivateAnalyse({ customerId: 'c1', projectId: 'p16', now: NOW, actor })
|
||||
assert.deepEqual((await consents('p16')).map((x) => x.event), ['on', 'on', 'off'])
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user