Store
The Store
module provides methods for getting and setting values in the test state.
store().get
Retrieves the value stored at the specified path in the test state.
Parameter | Type | Description |
---|---|---|
path | string | Path to the value to retrieve in the test state. |
Example
const value = await store().get('some.path.to.value');
store().set
Sets the value at the specified path in the test state.
Parameter | Type | Description |
---|---|---|
path | string | Path to set the value in the test state. |
value | any | Value to set at the specified path in the state. |
Example
await store().set('some.path.to.value', 'new value');
await store().set('some.nested.path', { key: 'value' });
Independent Usage
You can also use the store
module independently from the controller. Here's an example:
import { store } from "test-maker";
// Set a value in the test state
store.set(`appIsBusy.softFailure`, true);
In this example, we set the appIsBusy.softFailure
value to true
in the test state using the store
module independently.