describe('math', () => {
it('adds numbers', () => {
expect(1 + 2).toBe(3);
});
});Bu koddaki
it(...) neyi temsil eder?- aBirbiriyle ilgili testlerin gruplanması
- bTek bir test durumu (test case)✓
- cTestlerden önce çalışan bir setup hook'u
- dBir assertion kütüphanesi
Açıklama:
it() (test()'in bir takma adı) bir açıklama ve gerçek assertion'ları içeren callback ile tek bir test durumunu tanımlar. İlgili testleri gruplayan şey describe()'dur.