Skip to content

Commit 0c8531b

Browse files
committed
fixed tests
1 parent 88de4dd commit 0c8531b

File tree

6 files changed

+47
-14
lines changed

6 files changed

+47
-14
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/app/app/app.component.spec.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,21 @@
11
import { TestBed } from '@angular/core/testing';
22
import { AppComponent } from './app.component';
3+
import { ActivatedRoute } from '@angular/router';
34

45
describe('AppComponent', () => {
56
beforeEach(async () => {
67
await TestBed.configureTestingModule({
78
imports: [AppComponent],
9+
providers: [
10+
{
11+
provide: ActivatedRoute,
12+
useValue: {
13+
snapshot: {
14+
url: ["home"]
15+
}
16+
}
17+
},
18+
]
819
}).compileComponents();
920
});
1021

@@ -13,4 +24,8 @@ describe('AppComponent', () => {
1324
const app = fixture.componentInstance;
1425
expect(app).toBeTruthy();
1526
});
27+
28+
it('should have application version', () =>{
29+
expect(AppComponent.version).toBeTruthy();
30+
});
1631
});

src/app/cs2ts/cs2ts.component.spec.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
import { ComponentFixture, TestBed } from '@angular/core/testing';
22

33
import { Cs2tsComponent } from './cs2ts.component';
4+
import { provideAnimations } from '@angular/platform-browser/animations';
45

56
describe('Cs2tsComponent', () => {
67
let component: Cs2tsComponent;
78
let fixture: ComponentFixture<Cs2tsComponent>;
89

910
beforeEach(async () => {
1011
await TestBed.configureTestingModule({
11-
imports: [Cs2tsComponent]
12+
imports: [Cs2tsComponent],
13+
providers:[
14+
provideAnimations()
15+
]
1216
})
1317
.compileComponents();
1418

src/app/header/header.component.spec.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,25 @@
11
import { ComponentFixture, TestBed } from '@angular/core/testing';
22

33
import { HeaderComponent } from './header.component';
4+
import { ActivatedRoute } from '@angular/router';
45

56
describe('HeaderComponent', () => {
67
let component: HeaderComponent;
78
let fixture: ComponentFixture<HeaderComponent>;
89

910
beforeEach(async () => {
1011
await TestBed.configureTestingModule({
11-
imports: [HeaderComponent]
12+
imports: [HeaderComponent],
13+
providers: [
14+
{
15+
provide: ActivatedRoute,
16+
useValue: {
17+
snapshot: {
18+
url: ["home"]
19+
}
20+
}
21+
},
22+
]
1223
})
1324
.compileComponents();
1425

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,25 @@
11
import { ComponentFixture, TestBed } from '@angular/core/testing';
22

33
import { HomeComponent } from './home.component';
4+
import { ActivatedRoute } from '@angular/router';
45

56
describe('HomeComponent', () => {
67
let component: HomeComponent;
78
let fixture: ComponentFixture<HomeComponent>;
89

910
beforeEach(async () => {
1011
await TestBed.configureTestingModule({
11-
imports: [HomeComponent]
12+
imports: [HomeComponent],
13+
providers: [
14+
{
15+
provide: ActivatedRoute,
16+
useValue: {
17+
snapshot: {
18+
url: ["home"]
19+
}
20+
}
21+
},
22+
]
1223
})
1324
.compileComponents();
1425

@@ -21,16 +32,10 @@ describe('HomeComponent', () => {
2132
expect(component).toBeTruthy();
2233
});
2334

24-
it(`should have the 'CodeChef' title`, () => {
25-
const fixture = TestBed.createComponent(HomeComponent);
26-
const app = fixture.componentInstance;
27-
expect(app.title).toEqual('CodeChef');
28-
});
29-
3035
it('should render title', () => {
3136
const fixture = TestBed.createComponent(HomeComponent);
3237
fixture.detectChanges();
3338
const compiled = fixture.nativeElement as HTMLElement;
34-
expect(compiled.querySelector('h1')?.textContent).toContain('Hello, CodeChef');
39+
expect(compiled.querySelector('h1')?.textContent).toContain('CodeChef');
3540
});
3641
});

src/app/home/home.component.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ import { RouterLink } from '@angular/router';
99
templateUrl: './home.component.html'
1010
})
1111
export class HomeComponent {
12-
title = 'CodeChef';
13-
1412
constructor(meta:Meta){
1513
meta.addTags([
1614
{name: "description", content:"Developer utilities that automate simple and boring tasks, converts codes and more."},

0 commit comments

Comments
 (0)