Kundenseite: Reiter in der Adresse, Uebersicht mit Umlaut, Protokoll der Kundenansicht
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8c7a3fcced
commit
370724a9a7
6 files changed
+120
-7
No files matched your search
@@ -4,18 +4,19 @@ import { loadModule } from './load.mjs'
|
||||
|
||||
const { customerTabs, resolveCustomerTab } = await loadModule('src/lib/customerTabs.js')
|
||||
|
||||
test('customerTabs: Rechnungen nur für Admins, Reihenfolge bleibt', () => {
|
||||
test('customerTabs: Rechnungen nur für Admins, Reihenfolge mit Protokoll, Übersicht mit Umlaut', () => {
|
||||
assert.deepEqual(customerTabs(true), [
|
||||
{ id: 'overview', label: 'Uebersicht' },
|
||||
{ id: 'overview', label: 'Übersicht' },
|
||||
{ id: 'tickets', label: 'Tickets' },
|
||||
{ id: 'invoices', label: 'Rechnungen' },
|
||||
{ id: 'projects', label: 'Projekte' },
|
||||
{ id: 'protokoll', label: 'Protokoll' },
|
||||
])
|
||||
const staff = customerTabs(false)
|
||||
assert.deepEqual(staff.map((t) => t.id), ['overview', 'tickets', 'projects'])
|
||||
assert.deepEqual(staff.map((t) => t.id), ['overview', 'tickets', 'projects', 'protokoll'])
|
||||
// unbekannt oder nicht eindeutig true gilt als kein Admin
|
||||
for (const v of [undefined, null, 0, '', 'true']) {
|
||||
assert.deepEqual(customerTabs(v).map((t) => t.id), ['overview', 'tickets', 'projects'], String(v))
|
||||
assert.deepEqual(customerTabs(v).map((t) => t.id), ['overview', 'tickets', 'projects', 'protokoll'], String(v))
|
||||
}
|
||||
// die Einträge tragen nur id und label (kein internes Feld)
|
||||
assert.deepEqual(Object.keys(customerTabs(true)[2]), ['id', 'label'])
|
||||
@@ -28,6 +29,7 @@ test('resolveCustomerTab: erlaubter Reiter bleibt, sonst Übersicht', () => {
|
||||
assert.equal(resolveCustomerTab('tickets', false), 'tickets')
|
||||
assert.equal(resolveCustomerTab('projects', false), 'projects')
|
||||
assert.equal(resolveCustomerTab('overview', false), 'overview')
|
||||
assert.equal(resolveCustomerTab('protokoll', false), 'protokoll')
|
||||
assert.equal(resolveCustomerTab('gibtsnicht', true), 'overview')
|
||||
assert.equal(resolveCustomerTab(undefined, true), 'overview')
|
||||
})
|
||||
Reference in new issue
Block a user