mirror of
https://github.com/jjbrunton/Sauci.git
synced 2026-11-01 18:19:43 +00:00
feat(mobile): surface pending questions
Add a conditional Home cue for partner-answered questions and route both the card and catch-up reminders into the pending answer flow. Track prompt engagement and cover hidden, visible, CTA, and notification behavior.
This commit is contained in:
1 parent
9da44217f7
commit
2bc69c2790
7 files changed
+383
-13
No files matched your search
@@ -0,0 +1,47 @@
|
||||
import { router } from 'expo-router';
|
||||
import { handleNotificationResponse } from '@/lib/notifications';
|
||||
import { useMatchStore } from '@/store/matchStore';
|
||||
|
||||
jest.mock('expo-router', () => ({
|
||||
router: { push: jest.fn() },
|
||||
}));
|
||||
|
||||
jest.mock('expo-notifications', () => ({
|
||||
setNotificationHandler: jest.fn(),
|
||||
addNotificationResponseReceivedListener: jest.fn(),
|
||||
getLastNotificationResponseAsync: jest.fn(),
|
||||
getPermissionsAsync: jest.fn(),
|
||||
requestPermissionsAsync: jest.fn(),
|
||||
getExpoPushTokenAsync: jest.fn(),
|
||||
}));
|
||||
|
||||
jest.mock('@/lib/crashlytics', () => ({
|
||||
captureError: jest.fn(),
|
||||
}));
|
||||
|
||||
const notificationResponse = (type: string) => ({
|
||||
notification: {
|
||||
request: {
|
||||
content: { data: { type } },
|
||||
},
|
||||
},
|
||||
}) as never;
|
||||
|
||||
describe('handleNotificationResponse', () => {
|
||||
beforeEach(() => {
|
||||
useMatchStore.setState({ currentView: 'active' });
|
||||
});
|
||||
|
||||
it('opens the answer queue for a catch-up reminder', () => {
|
||||
handleNotificationResponse(notificationResponse('catchup_reminder'));
|
||||
|
||||
expect(useMatchStore.getState().currentView).toBe('pending');
|
||||
expect(router.push).toHaveBeenCalledWith('/(app)/swipe?mode=pending');
|
||||
});
|
||||
|
||||
it('ignores unknown notification types', () => {
|
||||
handleNotificationResponse(notificationResponse('unknown'));
|
||||
|
||||
expect(router.push).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user