# 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');
});

```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://vytautas.gitbook.io/ng-state/unit-testing/test-component-with-actions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
