Add additional lint rules
This commit is contained in:
parent
02d782c3da
commit
420b18eb78
67 changed files with 3686 additions and 1415 deletions
|
|
@ -14,9 +14,20 @@ describe('ShoppingListsPage', () => {
|
|||
vi.clearAllMocks();
|
||||
vi.mocked(useApiModule.useApi).mockReturnValue({
|
||||
householdId: 'hh1',
|
||||
householdIds: ['hh1'],
|
||||
isLoading: false,
|
||||
user: null,
|
||||
token: '123',
|
||||
isAuthenticated: true,
|
||||
profile: {
|
||||
_id: 'user1',
|
||||
keycloakId: 'user1',
|
||||
displayName: 'Test User',
|
||||
email: 'test@example.com',
|
||||
householdIds: ['hh1'],
|
||||
defaultHouseholdId: 'hh1',
|
||||
createdAt: '2026-05-10T00:00:00.000Z',
|
||||
updatedAt: '2026-05-10T00:00:00.000Z',
|
||||
},
|
||||
refreshProfile: vi.fn(),
|
||||
});
|
||||
vi.mocked(ShoppingListsService.getShoppingLists).mockResolvedValue([
|
||||
{ id: 'list2', name: 'Completed Costco', status: 'completed', items: [], totalEstimatedCost: 50, createdAt: '2026-05-09' } as any,
|
||||
|
|
@ -68,9 +79,7 @@ describe('ShoppingListsPage', () => {
|
|||
it('opens generate from meal plan modal', async () => {
|
||||
vi.mocked(MealPlansService.listMealPlans).mockResolvedValue({
|
||||
data: [{ _id: 'mp1', status: 'active', weekStartDate: '2026-05-10', days: [] } as any],
|
||||
total: 1,
|
||||
page: 1,
|
||||
limit: 10,
|
||||
pagination: { cursor: null, hasMore: false }
|
||||
});
|
||||
vi.mocked(ShoppingListsService.generateFromMealPlan).mockResolvedValue({
|
||||
id: 'list3', name: 'Generated', status: 'active', items: [], createdAt: '2026-05-11'
|
||||
|
|
@ -104,7 +113,7 @@ describe('ShoppingListsPage', () => {
|
|||
it('can cancel/close creation and gap scanning modals', async () => {
|
||||
vi.mocked(MealPlansService.listMealPlans).mockResolvedValue({
|
||||
data: [],
|
||||
total: 0, page: 1, limit: 10
|
||||
pagination: { cursor: null, hasMore: false }
|
||||
});
|
||||
|
||||
const { container } = render(<ShoppingListsPage />);
|
||||
|
|
@ -165,7 +174,7 @@ describe('ShoppingListsPage', () => {
|
|||
it('handles generate from meal plan failure', async () => {
|
||||
vi.mocked(MealPlansService.listMealPlans).mockResolvedValue({
|
||||
data: [{ _id: 'mp1', status: 'active', weekStartDate: '2026-05-10', days: [] } as any],
|
||||
total: 1, page: 1, limit: 10
|
||||
pagination: { cursor: null, hasMore: false }
|
||||
});
|
||||
vi.mocked(ShoppingListsService.generateFromMealPlan).mockRejectedValue(new Error('Gen failed'));
|
||||
const alertSpy = vi.spyOn(window, 'alert').mockImplementation(() => {});
|
||||
|
|
@ -314,7 +323,7 @@ describe('ShoppingListsPage', () => {
|
|||
it('handles gap scanner generation failure with generic error fallback', async () => {
|
||||
vi.mocked(MealPlansService.listMealPlans).mockResolvedValue({
|
||||
data: [{ _id: 'mp1', status: 'active', weekStartDate: '2026-05-10', days: [] } as any],
|
||||
total: 1, page: 1, limit: 10
|
||||
pagination: { cursor: null, hasMore: false }
|
||||
});
|
||||
vi.mocked(ShoppingListsService.generateFromMealPlan).mockRejectedValue({});
|
||||
const alertSpy = vi.spyOn(window, 'alert').mockImplementation(() => {});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue