import { describe, it, expect } from 'vitest'; import { TestBed } from '@angular/core/testing'; import { provideZonelessChangeDetection } from '@angular/core'; import { App } from './app'; import { appConfig } from './app.config'; describe('Quiz', () => { it('renders the initial contract and handles the documented operations', async () => { TestBed.configureTestingModule({ imports: [App], providers: [...(appConfig.providers ?? [])], }); const fixture = TestBed.createComponent(App); const element = fixture.nativeElement as HTMLElement; fixture.detectChanges(); await fixture.whenStable(); const text = () => element.querySelector('[data-result]')?.textContent?.trim(); expect(text()).toBe('2 allowance units'); element.querySelector('button')!.click(); fixture.detectChanges(); await fixture.whenStable(); expect(text()).toBe('6 allowance units'); fixture.destroy(); }); });