Default browser notifications on through a first-login permission prompt with category controls

Hop-State: A_06FPDKC36EGSF1DQQ929QZR
Hop-Proposal: R_06FPDKBGHD5F0RARPQPEGTG
Hop-Task: T_06FPDJYX8ADKQPCJRTD1TS8
Hop-Attempt: AT_06FPDJYX89JABJ674EYANCR
This commit is contained in:
2026-07-15 10:22:52 -07:00
committed by Hop
parent db5d8faba0
commit 30c917b3a9
4 changed files with 202 additions and 3 deletions
+16
View File
@@ -3,6 +3,7 @@ import { describe, expect, it } from 'vitest';
import {
browserNotificationsEnabledKey,
getBrowserNotificationContent,
parseBrowserNotificationPreferences,
} from './browser';
describe('browser notification presentation', () => {
@@ -11,6 +12,21 @@ describe('browser notification presentation', () => {
.toBe('synapsis:browser-notifications:user-1');
});
it('defaults every notification category on and preserves explicit choices', () => {
expect(parseBrowserNotificationPreferences(null)).toEqual({
follow: true,
like: true,
repost: true,
mention: true,
reply: true,
});
expect(parseBrowserNotificationPreferences('{"like":false}')).toMatchObject({
follow: true,
like: false,
mention: true,
});
});
it('links post interactions to the relevant post', () => {
expect(getBrowserNotificationContent({
id: 'notification-1',