Skip to content

Commit 1c796ef

Browse files
committed
feat: add test
1 parent 28316fe commit 1c796ef

File tree

1 file changed

+18
-29
lines changed

1 file changed

+18
-29
lines changed

frontend/src/angular/src/app/app.component.spec.ts

Lines changed: 18 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -15,34 +15,23 @@
1515
import { TestBed, waitForAsync } from "@angular/core/testing";
1616
import { RouterTestingModule } from "@angular/router/testing";
1717
import { AppComponent } from "./app.component";
18+
import { provideHttpClient, withInterceptorsFromDi } from "@angular/common/http";
19+
1820
describe("AppComponent", () => {
19-
// beforeEach(async(() => {
20-
// TestBed.configureTestingModule({
21-
// imports: [
22-
// RouterTestingModule
23-
// ],
24-
// declarations: [
25-
// AppComponent
26-
// ],
27-
// }).compileComponents();
28-
// }));
29-
// it('should create the app', async(() => {
30-
// const fixture = TestBed.createComponent(AppComponent);
31-
// const app = fixture.debugElement.componentInstance;
32-
// expect(app).toBeTruthy();
33-
// }));
34-
// it(`should have as title 'app'`, async(() => {
35-
// const fixture = TestBed.createComponent(AppComponent);
36-
// const app = fixture.debugElement.componentInstance;
37-
// expect(app.title).toEqual('app');
38-
// }));
39-
// it('should render title in a h1 tag', async(() => {
40-
// const fixture = TestBed.createComponent(AppComponent);
41-
// fixture.detectChanges();
42-
// const compiled = fixture.debugElement.nativeElement;
43-
// expect(compiled.querySelector('h1').textContent).toContain('Welcome to app!');
44-
// }));
45-
it("should calc correctly", () => {
46-
expect(1 + 1).toEqual(2);
47-
});
21+
beforeEach(waitForAsync(() => {
22+
TestBed.configureTestingModule({
23+
imports: [RouterTestingModule,AppComponent],
24+
providers: [provideHttpClient(withInterceptorsFromDi())]
25+
}).compileComponents();
26+
}));
27+
it("should create the app", waitForAsync(() => {
28+
const fixture = TestBed.createComponent(AppComponent);
29+
const app = fixture.debugElement.componentInstance;
30+
expect(app).toBeTruthy();
31+
}));
32+
it(`should have as title 'app'`, waitForAsync(() => {
33+
const fixture = TestBed.createComponent(AppComponent);
34+
const app = fixture.debugElement.componentInstance;
35+
expect(app.title).toEqual("app");
36+
}));
4837
});

0 commit comments

Comments
 (0)