title: NgRx 8 Test provideMockStore - setState for State Slice
body: <p>I have a smart component test for my NgRx implementation that looks something like this:</p>
  
  <pre class="lang-js prettyprint-override"><code>describe( 'Component', () =&gt; {
    let store: MockStore&lt;State&gt;;
  
    beforeEach( async( () =&gt; {
      TestBed.configureTestingModule( {
          /* ... */
          providers: [
              provideMockStore( { initialState: fromReducer.initialState } )
          ]
      } ).compileComponents();
      store = TestBed.get&lt;Store&lt;State&gt;&gt;( Store );
    } ) );
  
    it( 'should load items in #ngOnInit', () =&gt; {
      store.setState( {
          item: {
            ...fromReducer.initialState,
            entities: { [item.id]: item },
          },
          otherFeature: null,
          otherFeature: null,
          otherFeature: null
      } );
      component.items$.subscribe( items =&gt;
          store.select( ItemStoreSelectors.selectItems ).subscribe( fromStore =&gt; expect( items ).toEqual( fromStore ) )
      );
    } );
  });
  </code></pre>
  
  <p>I use <code>provideMockStore</code> and <code>setState</code> to mock my NgRx state. Everything works fine this way, but I really don't like this part of it:</p>
  
  <pre class="lang-js prettyprint-override"><code>store.setState( {
      item: {
        ...fromReducer.initialState,
        entities: { [item.id]: item },
      },
      otherFeature: null,
      otherFeature: null,
      otherFeature: null
  } );
  </code></pre>
  
  <p>I have to add every other feature slice of my state to the <code>setState</code> function. Otherwise Typescript will throw Errors.</p>
  
  <hr>
  
  <p>So preferably I don't want to set the root state, but rather a specific feature slice like this:</p>
  
  <pre class="lang-js prettyprint-override"><code>store.setState( {
    ...fromReducer.initialState,
    entities: { [item.id]: item },
  } );
  </code></pre>
  
  <p>I couldn't find any documentation on how to use <code>provideMockStore</code> for specific slices of the state <a href="https://ngrx.io/guide/store/testing" rel="nofollow noreferrer">here</a>.</p>