Complete the code to import the mocking library in a Remix test file.
import { [1] } from 'vitest';
The vi object is used in Vitest for mocking functions and modules.
Complete the code to create a mock function that returns 'hello' when called.
const mockFn = vi.[1](() => 'hello');
The vi.fn() method creates a mock function. Passing a function to it defines its implementation.
Fix the error in mocking a module named 'api' to return a fake user object.
vi.mock('./api', () => ({ [1]: () => ({ id: 1, name: 'Test User' }) }));
The mocked function name must match the exported function name from the 'api' module, which is getUser.
Fill both blanks to mock a module './db' with a function 'connect' that returns true.
vi.mock('./db', () => ({ [1]: () => [2] }));
The mocked function should be named connect and return true to simulate a successful connection.
Fill all three blanks to create a mock for './service' with a function 'fetchData' that returns an object with 'status' and 'data'.
vi.mock('./service', () => ({ [1]: () => ({ status: [2], data: [3] }) }));
The mock function is named fetchData. It returns an object with status set to 'success' and data as an array inside an object.