moar unit test !
Some checks failed
Deploy to Web Server flyer-crawler.projectium.com / deploy (push) Failing after 5m46s

This commit is contained in:
2025-12-07 14:29:37 -08:00
parent eec0967c94
commit ef07417978
13 changed files with 1393 additions and 220 deletions

View File

@@ -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 } from '../../types';
import { UserProfile, User, Flyer, Store, SuggestedCorrection, Brand, FlyerItem, MasterGroceryItem, ShoppingList, ShoppingListItem, Achievement, UserAchievement, Budget, SpendingByCategory, Recipe, RecipeComment, ActivityLogItem, DietaryRestriction, Appliance } from '../../types';
/**
* Creates a mock UserProfile object for use in tests, ensuring type safety.
@@ -358,4 +358,26 @@ export const createMockShoppingListItem = (overrides: Partial<ShoppingListItem>
};
return { ...defaultItem, ...overrides };
};
/**
* Creates a mock DietaryRestriction object for testing.
* @param overrides - Optional properties to override the defaults.
* @returns A mock DietaryRestriction object.
*/
export const createMockDietaryRestriction = (overrides: Partial<DietaryRestriction> = {}): DietaryRestriction => {
return {
dietary_restriction_id: 1,
name: 'Vegetarian',
type: 'diet',
...overrides,
};
};
export const createMockAppliance = (overrides: Partial<Appliance> = {}): Appliance => {
return {
appliance_id: 1,
name: 'Oven',
...overrides,
};
};