Files
nova-tenancy/tests-js/tenantState.test.js
T
2026-09-09 16:33:18 +03:30

26 lines
762 B
JavaScript

import { describe, expect, it } from 'vitest'
import {
currentLogoUrl,
sameTenant,
tenantInitial,
tenantStyle,
} from '../resources/js/tenantState'
describe('tenant state helpers', () => {
it('compares numeric and string tenant keys consistently', () => {
expect(sameTenant(12, '12')).toBe(true)
expect(sameTenant(null, null)).toBe(false)
})
it('builds safe presentation fallbacks', () => {
expect(tenantInitial(' alpha')).toBe('A')
expect(tenantStyle({ accent: null })).toEqual({ '--tenant-accent': '#7c3aed' })
})
it('creates a cache-busted fixed logo endpoint', () => {
expect(currentLogoUrl('/nova-vendor/nova-tenancy', 'a/b', 42)).toBe(
'/nova-vendor/nova-tenancy/current/logo?tenant=a%2Fb&v=42'
)
})
})