Skip to main content
Version: 9.0.0

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.

ParameterTypeDescription
pathstringPath 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.

ParameterTypeDescription
pathstringPath to set the value in the test state.
valueanyValue 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.