Files
sky_phone/frontend/src/utils/adminConfiguratorDescription.test.ts
T
DerEchteAlec a9143b0fba ADD - add in-game phone administration and configuration (#25)
* ADD - build in-game admin command center

* ADD - open admin panel by command

* ENH - rebuild admin panel as standalone editor

* ENH - compact admin workspace navigation

* ENH - expand admin device controls

* ENH - refine admin panel navigation style

* ADD - add SQL phone configurator

* FIX - expose complete phone configuration

* FIX - make company jobs freely configurable

* FIX - align configurator tables to left

* ENH - organize configurator collection controls

* ENH - organize nested configurator sections

* ENH - add configurator field descriptions

* FIX - hide fixed configurator add controls

* ENH - refine configurator editing experience

* ENH - refine admin configurator controls

* FIX - apply configurator settings instantly

* FIX - close live activity command registration

---------

Co-authored-by: Leon.Schmidt <leonmauricewill15@gmail.com>
2026-08-22 03:26:52 +02:00

63 lines
1.9 KiB
TypeScript

import { describe, expect, it } from 'vitest'
import type { AdminConfiguratorStructure } from '@/types/admin'
import {
configuratorDescriptionKey,
configuratorPathName,
describeConfiguratorValue,
} from './adminConfiguratorDescription'
describe('admin configurator descriptions', () => {
it('selects specific descriptions before generic value descriptions', () => {
expect(configuratorDescriptionKey('Bridge.CallbackTimeout', 15000)).toBe(
'milliseconds',
)
expect(configuratorDescriptionKey('Media.RequestTimeoutMs', 10000)).toBe(
'milliseconds',
)
expect(configuratorDescriptionKey('AdminPanel.AdminGroups', [])).toBe(
'access',
)
expect(configuratorDescriptionKey('FiveManage.ApiKey', '')).toBe(
'credential',
)
})
it('describes structured values from their schema', () => {
const vector: AdminConfiguratorStructure = {
kind: 'vector',
vectorType: 'vector3',
}
const table: AdminConfiguratorStructure = {
fields: {},
kind: 'table',
}
expect(configuratorDescriptionKey('Location', {}, vector)).toBe(
'coordinates',
)
expect(configuratorDescriptionKey('Settings', {}, table)).toBe('table')
})
it('passes a readable field name to the localized template', () => {
const translate = (key: string, params?: Record<string, string>) =>
`${key}:${params?.name}`
expect(
describeConfiguratorValue(
translate,
'CustomApps.MaximumStorageBytesPerApp',
262144,
),
).toBe('configurator.descriptions.byteLimit:Maximum Storage Bytes Per App')
expect(
describeConfiguratorValue(translate, 'Radio.AllowedJobs[2]', 'police'),
).toBe('configurator.descriptions.access:Allowed Jobs #2')
})
it('humanizes subtab keys', () => {
expect(configuratorPathName('ExternalPingResources')).toBe(
'External Ping Resources',
)
})
})