$ npm install @ngxs-labs/testing --save-dev
@ngxs-labs/testing is package for configures and initializes environment for ngxs unit testing and provides methods for creating states in unit tests.
Unit testing is easy with NGXS.
Unit testing actions
getStateContextMocks to mock and spy on the first argument of
@Actions functions: the
With this state:
getStateContextMocks allows the following tests:
it'should set state and dispatch new action',;it'should get state and patch to new value',;
mockSelect to quickly mock selector in component.
mockSelect provides a
Subject allowing to trigger the mocked selector on demand and with any value.