fix(notifications): format the tests, move the open-planner tab test into its own file, lower the exhaustive-deps baseline

This commit is contained in:
Maurice
2026-11-14 16:40:51 +01:00
parent b068e593fc
commit bfdbf4d811
5 changed files with 146 additions and 29 deletions
@@ -63,9 +63,14 @@ describe('useNotificationItemActions', () => {
it.each(['notif.vacay_invite.title', 'notif.vacay_share.title'])(
'opens the Vacay list for %s, including stored detail links',
async (title_key) => {
const { result } = renderHook(() => useNotificationItemActions(notification({
title_key, navigate_target: '/vacay/42',
})));
const { result } = renderHook(() =>
useNotificationItemActions(
notification({
title_key,
navigate_target: '/vacay/42',
})
)
);
await act(() => result.current.handleNavigate());
expect(navigate).toHaveBeenCalledWith('/vacay');
}
@@ -74,24 +79,41 @@ describe('useNotificationItemActions', () => {
it.each(['/trips/42', '/trips/42?tab=collab'])(
'opens Collab for both old and new message links: %s',
async (navigate_target) => {
const { result } = renderHook(() => useNotificationItemActions(notification({
title_key: 'notif.collab_message.title', navigate_target,
})));
const { result } = renderHook(() =>
useNotificationItemActions(
notification({
title_key: 'notif.collab_message.title',
navigate_target,
})
)
);
await act(() => result.current.handleNavigate());
expect(navigate).toHaveBeenCalledWith('/trips/42?tab=collab');
}
);
it('uses a trip-scoped message target when its link is missing, otherwise falls back to Dashboard', async () => {
const scoped = renderHook(() => useNotificationItemActions(notification({
title_key: 'notif.collab_message.title', scope: 'trip', target: 42, navigate_target: null,
})));
const scoped = renderHook(() =>
useNotificationItemActions(
notification({
title_key: 'notif.collab_message.title',
scope: 'trip',
target: 42,
navigate_target: null,
})
)
);
await act(() => scoped.result.current.handleNavigate());
expect(navigate).toHaveBeenLastCalledWith('/trips/42?tab=collab');
const missing = renderHook(() => useNotificationItemActions(notification({
title_key: 'notif.collab_message.title', navigate_target: '/dashboard',
})));
const missing = renderHook(() =>
useNotificationItemActions(
notification({
title_key: 'notif.collab_message.title',
navigate_target: '/dashboard',
})
)
);
await act(() => missing.result.current.handleNavigate());
expect(navigate).toHaveBeenLastCalledWith('/dashboard');
});