Kundenseite: Abo-Status und Funktionen; Seite E-Mail-Speicher
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
91d526e909
commit
cef0d5465e
8 files changed
+297
-4
No files matched your search
@@ -4,20 +4,23 @@ import { loadModule } from './load.mjs'
|
||||
|
||||
const { customerTabs, resolveCustomerTab } = await loadModule('src/lib/customerTabs.js')
|
||||
|
||||
test('customerTabs: Rechnungen nur für Admins, Reihenfolge mit Chat und Protokoll, Übersicht mit Umlaut', () => {
|
||||
test('customerTabs: volle Reiterfolge der Spec, Rechnungen nur für Admins', () => {
|
||||
assert.deepEqual(customerTabs(true), [
|
||||
{ id: 'overview', label: 'Übersicht' },
|
||||
{ id: 'tickets', label: 'Tickets' },
|
||||
{ id: 'invoices', label: 'Rechnungen' },
|
||||
{ id: 'projects', label: 'Projekte' },
|
||||
{ id: 'chat', label: 'Chat' },
|
||||
{ id: 'abo', label: 'Abo & Angebote' },
|
||||
{ id: 'gutschriften', label: 'Gutschriften' },
|
||||
{ id: 'funktionen', label: 'Funktionen' },
|
||||
{ id: 'protokoll', label: 'Protokoll' },
|
||||
])
|
||||
const staff = customerTabs(false)
|
||||
assert.deepEqual(staff.map((t) => t.id), ['overview', 'tickets', 'projects', 'chat', 'protokoll'])
|
||||
const STAFF = ['overview', 'tickets', 'projects', 'chat', 'abo', 'gutschriften', 'funktionen', 'protokoll']
|
||||
assert.deepEqual(customerTabs(false).map((t) => t.id), STAFF)
|
||||
// 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', 'chat', 'protokoll'], String(v))
|
||||
assert.deepEqual(customerTabs(v).map((t) => t.id), STAFF, String(v))
|
||||
}
|
||||
// die Einträge tragen nur id und label (kein internes Feld)
|
||||
assert.deepEqual(Object.keys(customerTabs(true)[2]), ['id', 'label'])
|
||||
@@ -32,6 +35,7 @@ test('resolveCustomerTab: erlaubter Reiter bleibt, sonst Übersicht', () => {
|
||||
assert.equal(resolveCustomerTab('overview', false), 'overview')
|
||||
assert.equal(resolveCustomerTab('protokoll', false), 'protokoll')
|
||||
assert.equal(resolveCustomerTab('chat', false), 'chat')
|
||||
for (const id of ['abo', 'gutschriften', 'funktionen']) assert.equal(resolveCustomerTab(id, false), id)
|
||||
assert.equal(resolveCustomerTab('gibtsnicht', true), 'overview')
|
||||
assert.equal(resolveCustomerTab(undefined, true), 'overview')
|
||||
})
|
||||
Reference in new issue
Block a user