fix(settings): preserve notification template edits (#2300)

This commit is contained in:
Aman Tahiliani
2026-08-06 21:17:16 +03:00
committed by GitHub
parent fa63866cbb
commit bcc64f7586
3 changed files with 43 additions and 6 deletions
@@ -0,0 +1,29 @@
import { afterEach, describe, expect, test } from 'bun:test';
import { useUIStore } from './useUIStore';
const initialTemplates = useUIStore.getState().notificationTemplates;
afterEach(() => {
useUIStore.setState({ notificationTemplates: initialTemplates });
});
describe('useUIStore notification templates', () => {
test('preserves rapid updates to separate template fields', () => {
const { setNotificationTemplates } = useUIStore.getState();
setNotificationTemplates((current) => ({
...current,
completion: { ...current.completion, title: 'Completed' },
}));
setNotificationTemplates((current) => ({
...current,
error: { ...current.error, message: 'Failed' },
}));
expect(useUIStore.getState().notificationTemplates).toEqual({
...initialTemplates,
completion: { ...initialTemplates.completion, title: 'Completed' },
error: { ...initialTemplates.error, message: 'Failed' },
});
});
});