Vue · Middle · Question 49 of 75

How do you test a component that uses Pinia stores?

Explanation

Actions become spies (expect(store.addItem).toHaveBeenCalled()), and initialState seeds the store. Store logic itself is tested separately with setActivePinia(createPinia()).

Further reading

Problem with a question

Vue · Middle · question 49

Test yourself

Take the Vue · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz