# कंपोनेंट टेस्ट करना — Angular Fundamentals: Components, Signals और Routing

Source: https://www.skillbyai.com/hi/angular/ng-testing-basics

> TestBed, change detection और component state पर assertions के साथ components को अलग से test करें।

## TestBed क्या करता है

`TestBed`, टेस्ट के लिए एक छोटा Angular मॉड्यूल बनाता है, जिससे आप असली या नकली निर्भरताओं के साथ कंपोनेंट बना सकते हैं और उसका रेंडर हुआ आउटपुट जाँच सकते हैं।

## एक न्यूनतम टेस्ट

यह टेस्ट कंपोनेंट बनाता है, चेंज डिटेक्शन ट्रिगर करता है, और इंस्टेंस पर एक मान जाँचता है।

```typescript
describe('CounterComponent', () => {
  it('increments the count', () => {
    const fixture = TestBed.createComponent(CounterComponent);
    const component = fixture.componentInstance;

    component.increment();
    fixture.detectChanges();

    expect(component.count()).toBe(1);
  });
});
```
