Advertisement
Thenlie

Untitled

Dec 18th, 2022
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import { vi } from 'vitest';
  2.  
  3. // mock MovieDB API calls
  4. const getMovieUtils = vi.mock('../../helpers/getMovieUtils', () => {
  5.     const sampleMovieData = vi.importActual('./assets/searchData.json');
  6.     const sampleMovieDetailsData = vi.importActual('./assets/movieData.json');
  7.     return {
  8.         default: {},
  9.         getMoviesByName: vi.fn().mockResolvedValue(sampleMovieData),
  10.         getMovieDetails: vi.fn().mockResolvedValue(sampleMovieDetailsData),
  11.     };
  12. });
  13.  
  14. export { getMovieUtils }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement