Skip to content

Commit

Permalink
fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
IPdotSetAF committed Oct 27, 2024
1 parent 88de4dd commit 0c8531b
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 14 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions src/app/app/app.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
import { TestBed } from '@angular/core/testing';
import { AppComponent } from './app.component';
import { ActivatedRoute } from '@angular/router';

describe('AppComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [AppComponent],
providers: [
{
provide: ActivatedRoute,
useValue: {
snapshot: {
url: ["home"]
}
}
},
]
}).compileComponents();
});

Expand All @@ -13,4 +24,8 @@ describe('AppComponent', () => {
const app = fixture.componentInstance;
expect(app).toBeTruthy();
});

it('should have application version', () =>{
expect(AppComponent.version).toBeTruthy();
});
});
6 changes: 5 additions & 1 deletion src/app/cs2ts/cs2ts.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

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

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

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [Cs2tsComponent]
imports: [Cs2tsComponent],
providers:[
provideAnimations()
]
})
.compileComponents();

Expand Down
13 changes: 12 additions & 1 deletion src/app/header/header.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { HeaderComponent } from './header.component';
import { ActivatedRoute } from '@angular/router';

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

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [HeaderComponent]
imports: [HeaderComponent],
providers: [
{
provide: ActivatedRoute,
useValue: {
snapshot: {
url: ["home"]
}
}
},
]
})
.compileComponents();

Expand Down
21 changes: 13 additions & 8 deletions src/app/home/home.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

import { HomeComponent } from './home.component';
import { ActivatedRoute } from '@angular/router';

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

beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [HomeComponent]
imports: [HomeComponent],
providers: [
{
provide: ActivatedRoute,
useValue: {
snapshot: {
url: ["home"]
}
}
},
]
})
.compileComponents();

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

it(`should have the 'CodeChef' title`, () => {
const fixture = TestBed.createComponent(HomeComponent);
const app = fixture.componentInstance;
expect(app.title).toEqual('CodeChef');
});

it('should render title', () => {
const fixture = TestBed.createComponent(HomeComponent);
fixture.detectChanges();
const compiled = fixture.nativeElement as HTMLElement;
expect(compiled.querySelector('h1')?.textContent).toContain('Hello, CodeChef');
expect(compiled.querySelector('h1')?.textContent).toContain('CodeChef');
});
});
2 changes: 0 additions & 2 deletions src/app/home/home.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import { RouterLink } from '@angular/router';
templateUrl: './home.component.html'
})
export class HomeComponent {
title = 'CodeChef';

constructor(meta:Meta){
meta.addTags([
{name: "description", content:"Developer utilities that automate simple and boring tasks, converts codes and more."},
Expand Down

0 comments on commit 0c8531b

Please sign in to comment.