# कंपोनेंट टेस्ट करना — एंगुलर

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

> TestBed किसी कंपोनेंट को टेस्ट करने के लिए एक अलग वातावरण तैयार करता है।

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