Files
native/src/lib/__tests__/settings-summary.test.ts
T
Linus Rath 6f515e15f7 feat: rework settings into the picked list, About and Storage & backup pages
The settings list now has the account card on top, title-case group
labels and 56 dp rows that show each pane's current value. About and
"About & Data" were one placeholder page with a letter logo, a fixed
name and a store link that pointed at GitHub releases.

- About: the real logo, the app name from app.config.js, the update
  state, a source link that a build can set with SOURCE_CODE_URL, and
  rows for the server, update checks (Android), open-source licences,
  privacy and a prefilled GitHub issue. iPhone updates link TestFlight.
- Storage & backup: usage card, offline mail, settings export/import
  and reset, and a Troubleshooting page for refresh and debug logging.
- Sender favicons moved to Appearance, like the webmail.
- The S/MIME and Plugins stub pages are gone; both are webmail plugins.

The licence list is generated by `scripts/generate-licences.mjs`.
2026-10-15 14:49:37 +02:00

54 lines
2.5 KiB
TypeScript

import { describe, it, expect } from 'vitest';
import { settingsSummary, type SummaryState } from '../settings-summary';
import { formatMessage, type MessageParams } from '../../i18n/format';
const t = (_key: string, fallback: string, params?: MessageParams) => formatMessage(fallback, params, 'en');
const BASE: SummaryState = {
languageLabel: 'English',
timeFormat: '24h',
theme: 'dark',
themeName: null,
emailNotificationsEnabled: true,
calendarNotificationsEnabled: false,
calendarDefaultView: 'month',
calendarFirstDayOfWeek: 1,
offlineCacheEnabled: false,
offlineCacheDays: 7,
offlineCacheMaxMB: 50,
appVersion: '0.1.76',
update: 'current',
};
describe('settings list summaries', () => {
it('shows the current values of a pane', () => {
expect(settingsSummary('language', BASE, t)).toBe('English · 24-hour');
expect(settingsSummary('language', { ...BASE, timeFormat: '12h' }, t)).toBe('English · 12-hour');
expect(settingsSummary('appearance', BASE, t)).toBe('Dark · Bulwark');
expect(settingsSummary('appearance', { ...BASE, theme: 'system', themeName: 'Nord' }, t)).toBe('System · Nord');
expect(settingsSummary('notifications', BASE, t)).toBe('Mail on · events off');
expect(settingsSummary('calendar', { ...BASE, calendarDefaultView: 'week', calendarFirstDayOfWeek: 0 }, t))
.toBe('Week · week starts Sunday');
});
it('describes offline mail on Storage & backup', () => {
expect(settingsSummary('about_data', BASE, t)).toBe('Offline mail off');
expect(settingsSummary('about_data', { ...BASE, offlineCacheEnabled: true, offlineCacheDays: 1 }, t))
.toBe('Offline mail on · 1 day, 50 MB');
expect(settingsSummary('about_data', { ...BASE, offlineCacheEnabled: true, offlineCacheMaxMB: 250 }, t))
.toBe('Offline mail on · 7 days, 250 MB');
});
it('puts the version and update state on About', () => {
expect(settingsSummary('about', BASE, t)).toBe('Version 0.1.76 · Up to date');
expect(settingsSummary('about', { ...BASE, update: 'available' }, t)).toBe('Version 0.1.76 · Update available');
expect(settingsSummary('about', { ...BASE, update: 'security' }, t)).toBe('Version 0.1.76 · Security update available');
expect(settingsSummary('about', { ...BASE, update: 'none' }, t)).toBe('Version 0.1.76');
});
it('falls back to a short description for panes without one value', () => {
expect(settingsSummary('filters', BASE, t)).toBe('Rules for incoming mail');
expect(settingsSummary('account', BASE, t)).toBeNull();
});
});