if you scroll a bit down on the testing docs there is the form shown of providing custom bootstrapping. in there you get access to au and further the di container
so use the container to grab the store instance and set the initial state manually via store.resetToState or directly overwriting (store as any)._state.setValue(yourstate)
When you say use the container to grab the store, does that mean the store should be a public (using TS) member of the component? For example this is the component I’m trying to test (State is the store btw).
@connectTo<State>({
onChanged: "stateChanged",
target: "state",
} as ConnectToSettings<State>)
@autoinject()
@applyTooltips(".cover-needs")
export class CoverNeeds {
private state: State;
... etc
What would the component.bootstrap implementation look like for setting the store? Do I need to refactor the component?
nope you dont need to modify your component. what I meant is, as shown in the stagedcomponent test docs that via a custom bootstrap you get a chance to access the aurelia instance and also its DI container before the component is created. So this way you can manipulate the container instance of the store, which is consumed by the connectTo decorator.
So you essentially setup the test environment before the component gets created and the test starts.