Add experimental double send

This commit is contained in:
Jack Kingsman
2026-02-10 20:33:14 -08:00
parent 6b5e9457a1
commit a157390fb7
18 changed files with 300 additions and 45 deletions
+1
View File
@@ -162,6 +162,7 @@ const baseConfig = {
const baseSettings = {
max_radio_contacts: 200,
experimental_channel_double_send: false,
favorites: [] as Array<{ type: 'channel' | 'contact'; id: string }>,
auto_decrypt_dm_on_advert: false,
sidebar_sort_order: 'recent' as const,
+21 -2
View File
@@ -2,7 +2,7 @@ import { fireEvent, render, screen, waitFor } from '@testing-library/react';
import { describe, expect, it, vi } from 'vitest';
import { SettingsModal } from '../components/SettingsModal';
import type { AppSettings, HealthStatus, RadioConfig } from '../types';
import type { AppSettings, AppSettingsUpdate, HealthStatus, RadioConfig } from '../types';
const baseConfig: RadioConfig = {
public_key: 'aa'.repeat(32),
@@ -29,6 +29,7 @@ const baseHealth: HealthStatus = {
const baseSettings: AppSettings = {
max_radio_contacts: 200,
experimental_channel_double_send: false,
favorites: [],
auto_decrypt_dm_on_advert: false,
sidebar_sort_order: 'recent',
@@ -40,7 +41,7 @@ const baseSettings: AppSettings = {
function renderModal(overrides?: {
appSettings?: AppSettings;
onSaveAppSettings?: (update: { max_radio_contacts?: number }) => Promise<void>;
onSaveAppSettings?: (update: AppSettingsUpdate) => Promise<void>;
onRefreshAppSettings?: () => Promise<void>;
}) {
const onSaveAppSettings = overrides?.onSaveAppSettings ?? vi.fn(async () => {});
@@ -120,4 +121,22 @@ describe('SettingsModal', () => {
expect(onSaveAppSettings).not.toHaveBeenCalled();
});
});
it('saves experimental channel double-send toggle through onSaveAppSettings', async () => {
const { onSaveAppSettings } = renderModal({
appSettings: { ...baseSettings, experimental_channel_double_send: false },
});
openConnectivityTab();
const toggle = screen.getByLabelText('Always send channel messages twice');
fireEvent.click(toggle);
fireEvent.click(screen.getByRole('button', { name: 'Save Settings' }));
await waitFor(() => {
expect(onSaveAppSettings).toHaveBeenCalledWith({
experimental_channel_double_send: true,
});
});
});
});