Chat: Korrekturen aus dem Abschlussreview

- Gespraech startet nicht neu, wenn der Kundenname nachlaedt (Entwurf bleibt, kein verwaister Timer)
- Neue Nachricht an Kunde: erst die eindeutige Beschriftung Name · E-Mail · Kd.-Nr. oeffnet

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ClaudeandClaude Opus 5.5 committed 2026-10-01 23:46:51 +00:00
1 parent eb0b889203
commit 813c6a7e18
4 files changed
+43 -7

No files matched your search

+19
View File
@@ -35,3 +35,22 @@ test('needsFullRefresh ab 10 Minuten', () => {
assert.equal(needsFullRefresh(0, 599999), false)
assert.equal(needsFullRefresh(0, 600000), true)
})
// Abschlussreview: die Auswahl "Neue Nachricht an Kunde…" darf nur eindeutig gewaehlte Kunden oeffnen
const { customerPickLabel, findCustomerByLabel } = await loadModule('src/lib/chatFormat.js')
test('customerPickLabel: Name · E-Mail · Kd.-Nr. wie im Admin-Panel, ohne Name die E-Mail', () => {
assert.equal(customerPickLabel({ $id: 'c1', name: 'Amin', email: 'a@x.de', code: '5' }), 'Amin · a@x.de · Kd.-Nr. 5')
assert.equal(customerPickLabel({ $id: 'c3', name: '', email: 'leer@x.de' }), 'leer@x.de')
})
test('findCustomerByLabel: Teil- oder Namens-Treffer oeffnen nichts, nur die volle Beschriftung', () => {
const customers = [
{ $id: 'c1', name: 'Amin', email: 'a@x.de', code: '5' },
{ $id: 'c2', name: 'Amin Friseur', email: 'f@x.de', code: '6' },
]
assert.equal(findCustomerByLabel(customers, 'Amin'), null)
assert.equal(findCustomerByLabel(customers, 'Amin Friseur'), null)
assert.equal(findCustomerByLabel(customers, 'Amin Friseur · f@x.de · Kd.-Nr. 6')?.$id, 'c2')
assert.equal(findCustomerByLabel(customers, 'Amin · a@x.de · Kd.-Nr. 5')?.$id, 'c1')
})