more test fixes
All checks were successful
Deploy to Test Environment / deploy-to-test (push) Successful in 1h8m48s
All checks were successful
Deploy to Test Environment / deploy-to-test (push) Successful in 1h8m48s
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
// src/features/flyer/AnalysisPanel.test.tsx
|
||||
import React from 'react';
|
||||
import { render, screen, fireEvent } from '@testing-library/react';
|
||||
import { describe, it, expect, vi, beforeEach, type Mock } from 'vitest';
|
||||
import { describe, it, expect, vi, beforeEach, afterEach, type Mock } from 'vitest';
|
||||
import { AnalysisPanel } from './AnalysisPanel';
|
||||
import { useFlyerItems } from '../../hooks/useFlyerItems';
|
||||
import type { Flyer, FlyerItem, Store, MasterGroceryItem } from '../../types';
|
||||
@@ -79,32 +79,16 @@ describe('AnalysisPanel', () => {
|
||||
generateImage: mockGenerateImage,
|
||||
});
|
||||
|
||||
// Mock Geolocation API
|
||||
Object.defineProperty(navigator, 'geolocation', {
|
||||
writable: true,
|
||||
value: {
|
||||
getCurrentPosition: vi.fn().mockImplementation((success) =>
|
||||
Promise.resolve(
|
||||
success({
|
||||
coords: {
|
||||
latitude: 51.1,
|
||||
longitude: 45.3,
|
||||
accuracy: 1,
|
||||
altitude: null,
|
||||
altitudeAccuracy: null,
|
||||
heading: null,
|
||||
speed: null,
|
||||
},
|
||||
timestamp: Date.now(),
|
||||
})
|
||||
)
|
||||
),
|
||||
},
|
||||
});
|
||||
console.log('DEBUG: beforeEach setup complete');
|
||||
});
|
||||
|
||||
it('should render tabs and an initial "Generate" button', () => {
|
||||
afterEach(() => {
|
||||
console.log('DEBUG: afterEach - cleaning up');
|
||||
vi.clearAllMocks();
|
||||
});
|
||||
|
||||
// Increased timeout to 20s to prevent flaky timeouts in slow environments
|
||||
it('should render tabs and an initial "Generate" button', { timeout: 20000 }, () => {
|
||||
console.log('DEBUG: Starting render for initial state test');
|
||||
const startTime = Date.now();
|
||||
render(<AnalysisPanel selectedFlyer={mockFlyer} />);
|
||||
|
||||
Reference in New Issue
Block a user