Complete the code to import the composable correctly.
import { [1] } from '@/composables/useUser';
The composable is named useUser and should be imported with that exact name.
Complete the code to mock the store using Pinia's testing utilities.
import { createTestingPinia } from '@pinia/testing'; const pinia = createTestingPinia({ [1]: false });
The option stubActions controls whether actions are stubbed or not in the testing Pinia instance.
Fix the error in mocking a composable by completing the jest.mock statement.
jest.mock('@/composables/useUser', () => ({ [1]: () => ({ name: 'Test User' }) }));
The mocked function must match the composable name useUser to replace it correctly.
Fill both blanks to mock a Pinia store and override a getter.
import { setActivePinia, createPinia } from 'pinia'; setActivePinia(createPinia()); const store = useUserStore(); store.[1] = [2];
The store property name is overridden with the string 'Test User' to mock the getter value.
Fill all three blanks to mock a composable and test its returned value.
import { mount } from '@vue/test-utils'; import Component from '@/components/UserProfile.vue'; jest.mock('@/composables/useUser', () => ({ [1]: () => ({ name: '[2]' }) })); const wrapper = mount(Component); expect(wrapper.text()).toContain('[3]');
The composable useUser is mocked to return a name 'Mock User'. The test checks that the component renders this name.