Skip to content

Commit

Permalink
fix: unit test fix using mock data
Browse files Browse the repository at this point in the history
  • Loading branch information
Kwaadpepper committed Oct 4, 2024
1 parent 98097a0 commit 2daa589
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ComponentFixture, TestBed } from '@angular/core/testing'

import { default as olympicJson } from './../../../assets/mock/olympic.json'
import { OlympicCountryLineChartComponent } from './olympic-country-line-chart.component'

describe('OlympicCountryLineChartComponent', () => {
Expand All @@ -14,6 +14,7 @@ describe('OlympicCountryLineChartComponent', () => {

fixture = TestBed.createComponent(OlympicCountryLineChartComponent)
component = fixture.componentInstance
component.participations = olympicJson[0]?.participations
fixture.detectChanges()
})

Expand Down
16 changes: 3 additions & 13 deletions src/app/pages/details/details.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import { AppComponent } from 'src/app/app.component'
import { OlympicCountryLineChartComponent } from 'src/app/components/olympic-country-line-chart/olympic-country-line-chart.component'
import { DetailsComponent } from './details.component'

import { default as olympicJson } from './../../../assets/mock/olympic.json'

describe('DetailsComponent', () => {
let component: DetailsComponent
let fixture: ComponentFixture<DetailsComponent>
Expand All @@ -21,19 +23,7 @@ describe('DetailsComponent', () => {
useValue: {
snapshot: {
data: {
olympicCountry: {
id: 2,
country: 'Spain',
participations: [
{
id: 1,
year: 2012,
city: 'Londres',
medalsCount: 20,
athleteCount: 315,
},
],
},
olympicCountry: olympicJson[0],
},
},
},
Expand Down
2 changes: 2 additions & 0 deletions tsconfig.spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"resolveJsonModule": true,
"esModuleInterop": true,
"outDir": "./out-tsc/spec",
"types": [
"jasmine",
Expand Down

0 comments on commit 2daa589

Please sign in to comment.