resources/js/admin/mobile/lib.
- Admin push is end‑to‑end: new backend model/migration/service/job + API endpoints, admin runtime config, push‑aware
service worker, and a settings toggle via useAdminPushSubscription. Notifications now auto‑refresh on push.
- New PHP/JS tests: admin push API feature test and queue/haptics unit tests
Added admin-specific PWA icon assets and wired them into the admin manifest, service worker, and admin shell, plus a
new “Device & permissions” card in mobile Settings with a persistent storage action and translations.
Details: public/manifest.json, public/admin-sw.js, resources/views/admin.blade.php, new icons in public/; new hook
resources/js/admin/mobile/hooks/useDevicePermissions.ts, helpers/tests in resources/js/admin/mobile/lib/
devicePermissions.ts + resources/js/admin/mobile/lib/devicePermissions.test.ts, and Settings UI updates in resources/
js/admin/mobile/SettingsPage.tsx with copy in resources/js/admin/i18n/locales/en/management.json and resources/js/
admin/i18n/locales/de/management.json.
35 lines
1.0 KiB
TypeScript
35 lines
1.0 KiB
TypeScript
import { describe, expect, it } from 'vitest';
|
|
import { normalizePermissionState, resolveStorageStatus } from './devicePermissions';
|
|
|
|
describe('normalizePermissionState', () => {
|
|
it('maps default to prompt', () => {
|
|
expect(normalizePermissionState('default')).toBe('prompt');
|
|
});
|
|
|
|
it('maps undefined to unsupported', () => {
|
|
expect(normalizePermissionState(undefined)).toBe('unsupported');
|
|
});
|
|
|
|
it('passes through granted', () => {
|
|
expect(normalizePermissionState('granted')).toBe('granted');
|
|
});
|
|
|
|
it('passes through denied', () => {
|
|
expect(normalizePermissionState('denied')).toBe('denied');
|
|
});
|
|
});
|
|
|
|
describe('resolveStorageStatus', () => {
|
|
it('returns unsupported when not supported', () => {
|
|
expect(resolveStorageStatus(null, false)).toBe('unsupported');
|
|
});
|
|
|
|
it('returns persisted when granted', () => {
|
|
expect(resolveStorageStatus(true, true)).toBe('persisted');
|
|
});
|
|
|
|
it('returns available when supported but not persisted', () => {
|
|
expect(resolveStorageStatus(false, true)).toBe('available');
|
|
});
|
|
});
|