I have this
@connectTo<State>({
selector: (store) => store.state.pipe(pluck('gui')).pipe(pluck('navbar')).pipe(pluck('burgerIsOpen')),
target: 'burgerIsOpen',
})
and it works fine in a normal browser context
FAILED TESTS:
Stage App Component
✖ should render message
HeadlessChrome 80.0.3987 (Linux 0.0.0)
Uncaught TypeError: Cannot read property 'gui' of undefined thrown
this is my configuration
import Game from './components/games/Game';
import { NavBarState } from './general/navbar/NavBarState';
export interface State {
readonly gui: UiState;
readonly domain: DomainState;
}
interface UiState {
navbar: NavBarState;
}
interface DomainState {
readonly games: Game[];
readonly myGames: Game[];
}
export const initialState: State = {
gui: {
navbar: {
burgerIsOpen: false,
},
},
domain: {
games: [
{ name: 'Warhammer 40k', id: '40k' },
{ name: 'Age of Sigmar', id: 'aos' },
],
myGames: [],
}
};
import { Aurelia, LogManager } from 'aurelia-framework';
import { ConsoleAppender } from 'aurelia-logging-console';
import { PLATFORM } from 'aurelia-pal';
import { LogLevel } from 'aurelia-store';
import { setAutoFreeze } from 'immer';
import * as environment from '../config/environment.json';
import { initialState } from './State';
export function configure(aurelia: Aurelia) {
aurelia.use
.standardConfiguration()
.feature(PLATFORM.moduleName('resources/index'));
LogManager.addAppender(new ConsoleAppender());
LogManager.setLevel(LogManager.logLevel.debug);
LogManager.getLogger('main').debug('initializing');
setAutoFreeze(environment.debug || environment.testing);
if (environment.testing) {
aurelia.use.plugin(PLATFORM.moduleName('aurelia-testing'));
}
aurelia.use.plugin(PLATFORM.moduleName('aurelia-store'), {
initialState,
logDispatchedActions: true,
logDefinitions: {
dispatchedActions: LogLevel.info
}
});
aurelia.start().then(() => aurelia.setRoot(PLATFORM.moduleName('app')));
}