comment out road trip planning as it requires google maps api key $$$
All checks were successful
Deploy to Web Server flyer-crawler.projectium.com / deploy (push) Successful in 4m27s
All checks were successful
Deploy to Web Server flyer-crawler.projectium.com / deploy (push) Successful in 4m27s
This commit is contained in:
@@ -27,7 +27,7 @@ describe('AnalysisPanel', () => {
|
||||
mockedAiApiClient.getQuickInsights.mockReset();
|
||||
mockedAiApiClient.getDeepDiveAnalysis.mockReset();
|
||||
mockedAiApiClient.searchWeb.mockReset();
|
||||
mockedAiApiClient.planTripWithMaps.mockReset();
|
||||
// mockedAiApiClient.planTripWithMaps.mockReset();
|
||||
mockedAiApiClient.generateImageFromText.mockReset();
|
||||
|
||||
// Mock Geolocation API
|
||||
@@ -133,28 +133,28 @@ describe('AnalysisPanel', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('should display a specific error for geolocation permission denial', async () => {
|
||||
// Provide explicit types for the success and error callbacks to satisfy TypeScript
|
||||
(navigator.geolocation.getCurrentPosition as Mock).mockImplementation(
|
||||
(
|
||||
success: (position: GeolocationPosition) => void,
|
||||
error: (error: GeolocationPositionError) => void
|
||||
) => {
|
||||
error({ code: 1, message: 'User denied Geolocation', PERMISSION_DENIED: 1, POSITION_UNAVAILABLE: 2, TIMEOUT: 3 });
|
||||
}
|
||||
);
|
||||
render(<AnalysisPanel flyerItems={mockFlyerItems} store={mockStore} />);
|
||||
fireEvent.click(screen.getByRole('tab', { name: /plan trip/i }));
|
||||
fireEvent.click(screen.getByRole('button', { name: /generate plan trip/i }));
|
||||
// it('should display a specific error for geolocation permission denial', async () => {
|
||||
// // Provide explicit types for the success and error callbacks to satisfy TypeScript
|
||||
// (navigator.geolocation.getCurrentPosition as Mock).mockImplementation(
|
||||
// (
|
||||
// success: (position: GeolocationPosition) => void,
|
||||
// error: (error: GeolocationPositionError) => void
|
||||
// ) => {
|
||||
// error({ code: 1, message: 'User denied Geolocation', PERMISSION_DENIED: 1, POSITION_UNAVAILABLE: 2, TIMEOUT: 3 });
|
||||
// }
|
||||
// );
|
||||
// render(<AnalysisPanel flyerItems={mockFlyerItems} store={mockStore} />);
|
||||
// fireEvent.click(screen.getByRole('tab', { name: /plan trip/i }));
|
||||
// fireEvent.click(screen.getByRole('button', { name: /generate plan trip/i }));
|
||||
|
||||
// When geolocation fails, the component logs an error and sets the result to an empty string.
|
||||
// It does not display a specific error message in the UI in this case.
|
||||
// The test should verify that no result is displayed and no API call is made.
|
||||
await waitFor(() => {
|
||||
expect(mockedAiApiClient.planTripWithMaps).not.toHaveBeenCalled();
|
||||
expect(screen.queryByText(/Please allow location access/i)).not.toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
// // When geolocation fails, the component logs an error and sets the result to an empty string.
|
||||
// // It does not display a specific error message in the UI in this case.
|
||||
// // The test should verify that no result is displayed and no API call is made.
|
||||
// await waitFor(() => {
|
||||
// expect(mockedAiApiClient.planTripWithMaps).not.toHaveBeenCalled();
|
||||
// expect(screen.queryByText(/Please allow location access/i)).not.toBeInTheDocument();
|
||||
// });
|
||||
// });
|
||||
|
||||
it('should show and call generateImageFromText for Deep Dive results', async () => {
|
||||
mockedAiApiClient.getDeepDiveAnalysis.mockResolvedValue(new Response(JSON.stringify('This is a meal plan.')));
|
||||
|
||||
Reference in New Issue
Block a user