Refactor context and provider structure for improved organization and maintainability
Some checks failed
Deploy to Test Environment / deploy-to-test (push) Has been cancelled

- Removed individual context files for Auth, Flyers, MasterItems, Modal, UserData, and their respective hooks.
- Introduced centralized provider files for each context, encapsulating logic and state management.
- Updated imports across the application to reflect the new structure, ensuring all hooks and contexts are correctly referenced.
- Enhanced the AppProviders component to streamline the wrapping of all context providers in the application.
- Improved type definitions and context management for better type safety and clarity.
This commit is contained in:
2025-12-14 21:00:58 -08:00
parent 82b7ce82e7
commit 43ca7f9df2
29 changed files with 197 additions and 204 deletions

View File

@@ -2,15 +2,15 @@
import { renderHook, act } from '@testing-library/react';
import { describe, it, expect, vi, beforeEach } from 'vitest';
import { useWatchedItems } from './useWatchedItems';
import { useApi } from '../hooks/useApi';
import { useAuth } from '../contexts/AuthContext';
import { useUserData } from './useUserData';
import { useApi } from './useApi';
import { useAuth } from '../hooks/useAuth';
import { useUserData } from '../hooks/useUserData';
import type { MasterGroceryItem, User } from '../types';
// Mock the hooks that useWatchedItems depends on
vi.mock('../hooks/useApi');
vi.mock('../contexts/AuthContext');
vi.mock('./useUserData');
vi.mock('./useApi');
vi.mock('../hooks/useAuth');
vi.mock('../hooks/useUserData');
// The apiClient is globally mocked in our test setup, so we just need to cast it
const mockedUseApi = vi.mocked(useApi);