Skip to content

Commit 1117d5c

Browse files
committed
Added tests in app section
1 parent b1c98f2 commit 1117d5c

1 file changed

Lines changed: 19 additions & 5 deletions

File tree

src/app/app.component.spec.ts

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,38 @@
1-
import { TestBed } from '@angular/core/testing';
1+
import { ComponentFixture, TestBed } from '@angular/core/testing';
22
import { RouterTestingModule } from '@angular/router/testing';
33
import { AppComponent } from './app.component';
44

55
describe('AppComponent', () => {
6+
let app: AppComponent;
7+
let fixture: ComponentFixture<AppComponent>;
8+
69
beforeEach(async () => {
710
await TestBed.configureTestingModule({
811
imports: [RouterTestingModule],
912
declarations: [AppComponent],
1013
}).compileComponents();
1114
});
1215

16+
beforeEach(() => {
17+
fixture = TestBed.createComponent(AppComponent);
18+
app = fixture.componentInstance;
19+
fixture.detectChanges();
20+
});
21+
1322
it('should create the app', () => {
14-
const fixture = TestBed.createComponent(AppComponent);
15-
const app = fixture.componentInstance;
1623
expect(app).toBeTruthy();
1724
});
1825

1926
it(`should have as title 'DSOMM'`, () => {
20-
const fixture = TestBed.createComponent(AppComponent);
21-
const app = fixture.componentInstance;
2227
expect(app.title).toEqual('DSOMM');
2328
});
29+
30+
it('check for fork me on github ribbon generation', () => {
31+
const fixture = TestBed.createComponent(AppComponent);
32+
const HTMLElement: HTMLElement = fixture.nativeElement;
33+
var divTag = HTMLElement.querySelector('div')!;
34+
var aTag = divTag.querySelector('a')!;
35+
//console.log(aTag);
36+
expect(aTag.textContent).toEqual('Fork me on GitHub');
37+
});
2438
});

0 commit comments

Comments
 (0)