mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-20 19:16:08 +00:00
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:
@@ -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');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user