# Test component with actions

Components can be tested seperatly or using Angular TestBed.&#x20;

To test component seperatly please use bellow technique

```typescript
beforeEach(() => {
    NgStateTestBed.setTestEnvironment(new ImmerDataStrategy());
    NgStateTestBed.strictActionsCheck = false;
    
    copyInitialState = JSON.parse(JSON.stringify(initialState));
    copyInitialState.todos.push(<TodoModel>{ description: 'test description' });
    NgStateTestBed.createStore(copyInitialState);
    component = new TodoDescription(cd as any);
});

it('should get description - immer', () => {
    component.stateIndex = 1;
    component.statePath = ['todos'];
    component.ngOnInit();
    expect(component.actions.todoDescription).toEqual('test description');
});

```
