From 1d97a8aa7c96b1af36d926f4a04d0c99961a0458 Mon Sep 17 00:00:00 2001 From: Dagger Date: Wed, 11 Mar 2026 23:14:40 +0000 Subject: [PATCH] add_unit_tests_for_appcomponent_1773270854 --- src/app/app.component.spec.ts | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/app/app.component.spec.ts diff --git a/src/app/app.component.spec.ts b/src/app/app.component.spec.ts new file mode 100644 index 0000000..a1824c6 --- /dev/null +++ b/src/app/app.component.spec.ts @@ -0,0 +1,30 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { App } from './app.ts'; // Assuming App is exported as App, not AppComponent + +describe('App', () => { + let fixture: ComponentFixture; + let component: App; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [App], // Standalone components are imported directly + }).compileComponents(); + + fixture = TestBed.createComponent(App); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create the app', () => { + expect(component).toBeTruthy(); + }); + + it('should have the title 'daggerverse-test-angular-project'', () => { + expect(component.title()).toEqual('daggerverse-test-angular-project'); + }); + + it('should render title in an h1 tag', () => { + const compiled = fixture.nativeElement as HTMLElement; + expect(compiled.querySelector('h1')?.textContent).toContain('Hello, daggerverse-test-angular-project'); + }); +});