Gas Station Feature
This commit is contained in:
95
backend/src/features/stations/tests/fixtures/mock-google-response.ts
vendored
Normal file
95
backend/src/features/stations/tests/fixtures/mock-google-response.ts
vendored
Normal file
@@ -0,0 +1,95 @@
|
||||
/**
|
||||
* @ai-summary Mock Google Places API responses for tests
|
||||
*/
|
||||
|
||||
import { GooglePlacesResponse } from '../../external/google-maps/google-maps.types';
|
||||
|
||||
export const mockGoogleNearbySearchResponse: GooglePlacesResponse = {
|
||||
results: [
|
||||
{
|
||||
geometry: {
|
||||
location: {
|
||||
lat: 37.7749,
|
||||
lng: -122.4194
|
||||
}
|
||||
},
|
||||
name: 'Shell Gas Station - Downtown',
|
||||
place_id: 'ChIJN1blFMzZrIEElx_JXUzRLdc',
|
||||
vicinity: '123 Main St, San Francisco, CA 94105',
|
||||
rating: 4.2,
|
||||
photos: [
|
||||
{
|
||||
photo_reference: 'photo_ref_1'
|
||||
}
|
||||
],
|
||||
opening_hours: {
|
||||
open_now: true
|
||||
},
|
||||
types: ['gas_station', 'point_of_interest', 'establishment']
|
||||
},
|
||||
{
|
||||
geometry: {
|
||||
location: {
|
||||
lat: 37.7923,
|
||||
lng: -122.3989
|
||||
}
|
||||
},
|
||||
name: 'Chevron Station - Financial District',
|
||||
place_id: 'ChIJN1blFMzZrIEElx_JXUzRLde',
|
||||
vicinity: '456 Market St, San Francisco, CA 94102',
|
||||
rating: 4.5,
|
||||
photos: [
|
||||
{
|
||||
photo_reference: 'photo_ref_2'
|
||||
}
|
||||
],
|
||||
opening_hours: {
|
||||
open_now: true
|
||||
},
|
||||
types: ['gas_station', 'point_of_interest', 'establishment']
|
||||
}
|
||||
],
|
||||
status: 'OK'
|
||||
};
|
||||
|
||||
export const mockGooglePlaceDetailsResponse = {
|
||||
result: {
|
||||
geometry: {
|
||||
location: {
|
||||
lat: 37.7749,
|
||||
lng: -122.4194
|
||||
}
|
||||
},
|
||||
name: 'Shell Gas Station - Downtown',
|
||||
place_id: 'ChIJN1blFMzZrIEElx_JXUzRLdc',
|
||||
formatted_address: '123 Main St, San Francisco, CA 94105',
|
||||
rating: 4.2,
|
||||
user_ratings_total: 150,
|
||||
formatted_phone_number: '+1 (415) 555-0100',
|
||||
website: 'https://www.shell.com',
|
||||
opening_hours: {
|
||||
weekday_text: [
|
||||
'Monday: 12:00 AM – 11:59 PM',
|
||||
'Tuesday: 12:00 AM – 11:59 PM'
|
||||
]
|
||||
},
|
||||
photos: [
|
||||
{
|
||||
photo_reference: 'photo_ref_1'
|
||||
}
|
||||
],
|
||||
types: ['gas_station', 'point_of_interest', 'establishment']
|
||||
},
|
||||
status: 'OK'
|
||||
};
|
||||
|
||||
export const mockGoogleErrorResponse = {
|
||||
results: [],
|
||||
status: 'ZERO_RESULTS'
|
||||
};
|
||||
|
||||
export const mockGoogleApiErrorResponse = {
|
||||
results: [],
|
||||
status: 'REQUEST_DENIED',
|
||||
error_message: 'Invalid API key'
|
||||
};
|
||||
79
backend/src/features/stations/tests/fixtures/mock-stations.ts
vendored
Normal file
79
backend/src/features/stations/tests/fixtures/mock-stations.ts
vendored
Normal file
@@ -0,0 +1,79 @@
|
||||
/**
|
||||
* @ai-summary Mock station data for tests
|
||||
*/
|
||||
|
||||
import { Station, SavedStation } from '../../domain/stations.types';
|
||||
|
||||
export const mockStations: Station[] = [
|
||||
{
|
||||
id: 'station-1',
|
||||
placeId: 'ChIJN1blFMzZrIEElx_JXUzRLdc',
|
||||
name: 'Shell Gas Station - Downtown',
|
||||
address: '123 Main St, San Francisco, CA 94105',
|
||||
latitude: 37.7749,
|
||||
longitude: -122.4194,
|
||||
rating: 4.2,
|
||||
distance: 250,
|
||||
photoUrl: 'https://example.com/shell-downtown.jpg',
|
||||
priceRegular: 4.29,
|
||||
pricePremium: 4.79,
|
||||
priceDiesel: 4.49
|
||||
},
|
||||
{
|
||||
id: 'station-2',
|
||||
placeId: 'ChIJN1blFMzZrIEElx_JXUzRLde',
|
||||
name: 'Chevron Station - Financial District',
|
||||
address: '456 Market St, San Francisco, CA 94102',
|
||||
latitude: 37.7923,
|
||||
longitude: -122.3989,
|
||||
rating: 4.5,
|
||||
distance: 1200,
|
||||
photoUrl: 'https://example.com/chevron-fd.jpg',
|
||||
priceRegular: 4.39,
|
||||
pricePremium: 4.89
|
||||
},
|
||||
{
|
||||
id: 'station-3',
|
||||
placeId: 'ChIJN1blFMzZrIEElx_JXUzRLdf',
|
||||
name: 'Exxon Mobile - Mission',
|
||||
address: '789 Valencia St, San Francisco, CA 94103',
|
||||
latitude: 37.7599,
|
||||
longitude: -122.4148,
|
||||
rating: 3.8,
|
||||
distance: 1850,
|
||||
photoUrl: 'https://example.com/exxon-mission.jpg',
|
||||
priceRegular: 4.19,
|
||||
priceDiesel: 4.39
|
||||
}
|
||||
];
|
||||
|
||||
export const mockSavedStations: SavedStation[] = [
|
||||
{
|
||||
id: '550e8400-e29b-41d4-a716-446655440000',
|
||||
userId: 'user123',
|
||||
stationId: mockStations[0].placeId,
|
||||
nickname: 'Work Gas Station',
|
||||
notes: 'Usually has good prices, rewards program available',
|
||||
isFavorite: true,
|
||||
createdAt: new Date('2024-01-01'),
|
||||
updatedAt: new Date('2024-01-15')
|
||||
},
|
||||
{
|
||||
id: '550e8400-e29b-41d4-a716-446655440001',
|
||||
userId: 'user123',
|
||||
stationId: mockStations[1].placeId,
|
||||
nickname: 'Home Station',
|
||||
notes: 'Closest to apartment',
|
||||
isFavorite: true,
|
||||
createdAt: new Date('2024-01-05'),
|
||||
updatedAt: new Date('2024-01-10')
|
||||
}
|
||||
];
|
||||
|
||||
export const searchCoordinates = {
|
||||
sanFrancisco: { latitude: 37.7749, longitude: -122.4194 },
|
||||
losAngeles: { latitude: 34.0522, longitude: -118.2437 },
|
||||
seattle: { latitude: 47.6062, longitude: -122.3321 }
|
||||
};
|
||||
|
||||
export const mockUserId = 'user123';
|
||||
Reference in New Issue
Block a user