title="Watch a free video of Mastering Pinia about testing stores"
/> -->
-
This can be achieved with `createTestingPinia()`, which returns a pinia instance designed to help unit tests components.
Start by installing `@pinia/testing`:
store.someAction.mockResolvedValue('some value')
```
+If you are interesting in learning more tricks like this, you should check out the Testing lessons on [Mastering Pinia](https://masteringpinia.com/lessons/exercise-mocking-stores-introduction).
+
### Specifying the createSpy function
When using Jest, or vitest with `globals: true`, `createTestingPinia` automatically stubs actions using the spy function based on the existing test framework (`jest.fn` or `vitest.fn`). If you are not using `globals: true` or using a different framework, you'll need to provide a [createSpy](/api/interfaces/pinia_testing.TestingOptions.html#createspy) option: