moar fixes + unit test review of routes
All checks were successful
Deploy to Test Environment / deploy-to-test (push) Successful in 57m53s
All checks were successful
Deploy to Test Environment / deploy-to-test (push) Successful in 57m53s
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// src/tests/utils/mockFactories.ts
|
||||
import { UserProfile, User, Flyer, Store, SuggestedCorrection, Brand, FlyerItem, MasterGroceryItem, ShoppingList, ShoppingListItem, Achievement, UserAchievement, Budget, SpendingByCategory, Recipe, RecipeComment, ActivityLogItem, DietaryRestriction, Appliance, Notification, UnmatchedFlyerItem, AdminUserView, WatchedItemDeal, LeaderboardUser, UserWithPasswordHash, Profile } from '../../types';
|
||||
import { UserProfile, User, Flyer, Store, SuggestedCorrection, Brand, FlyerItem, MasterGroceryItem, ShoppingList, ShoppingListItem, Achievement, UserAchievement, Budget, SpendingByCategory, Recipe, RecipeComment, ActivityLogItem, DietaryRestriction, Appliance, Notification, UnmatchedFlyerItem, AdminUserView, WatchedItemDeal, LeaderboardUser, UserWithPasswordHash, Profile, Address } from '../../types';
|
||||
|
||||
/**
|
||||
* Creates a mock UserProfile object for use in tests, ensuring type safety.
|
||||
@@ -374,6 +374,31 @@ export const createMockDietaryRestriction = (overrides: Partial<DietaryRestricti
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a mock Address object for use in tests.
|
||||
* @param overrides - An object containing properties to override the default mock values.
|
||||
* @returns A complete and type-safe Address object.
|
||||
*/
|
||||
export const createMockAddress = (overrides: Partial<Address> = {}): Address => {
|
||||
const defaultAddress: Address = {
|
||||
address_id: Math.floor(Math.random() * 1000),
|
||||
address_line_1: '123 Mock St',
|
||||
city: 'Mockville',
|
||||
province_state: 'BC',
|
||||
postal_code: 'V8T 1A1',
|
||||
country: 'CA',
|
||||
created_at: new Date().toISOString(),
|
||||
updated_at: new Date().toISOString(),
|
||||
// Optional fields
|
||||
address_line_2: null,
|
||||
latitude: null,
|
||||
longitude: null,
|
||||
location: null,
|
||||
};
|
||||
|
||||
return { ...defaultAddress, ...overrides };
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a mock UserWithPasswordHash object for use in tests.
|
||||
* @param overrides - An object containing properties to override the default mock values.
|
||||
|
||||
Reference in New Issue
Block a user