Self hosted FLOSS fitness/workout, nutrition and weight tracker
Move test data to folder
Roland Geider92af1c69d0a1
diff --git a/angular/src/app/exercise/exercise-detail/exercise-detail.component.spec.ts b/angular/src/app/exercise/exercise-detail/exercise-detail.component.spec.tsindex 8b2ee6eaa..28ab8a515 100644--- a/angular/src/app/exercise/exercise-detail/exercise-detail.component.spec.ts+++ b/angular/src/app/exercise/exercise-detail/exercise-detail.component.spec.ts@@ -1,8 +1,7 @@import {HttpClientTestingModule} from '@angular/common/http/testing';import {ComponentFixture, TestBed} from '@angular/core/testing';import {ExerciseService} from '../exercise.service';-import {Category} from '../models/exercises/category.model';-import {Exercise} from '../models/exercises/exercise.model';+import { exercise1 } from '../test-data/exercise';import {ExerciseDetailComponent} from './exercise-detail.component';@@ -22,19 +21,7 @@ describe('ExerciseComponent', () => {beforeEach(() => {fixture = TestBed.createComponent(ExerciseDetailComponent);component = fixture.componentInstance;- component.exercise = new Exercise(1,- 'abcd',- 'Cool exercise',- new Date(2021, 5, 10),- 'Take the weight, move it. ',- 1,- [1, 2, 3],- [5, 6],- [1, 8],- 2,- 'author',- [2]);- component.exercise.category = new Category(1, 'Arms');+ component.exercise = exercise1;fixture.detectChanges();});diff --git a/angular/src/app/exercise/exercise-edit/exercise-edit.component.spec.ts b/angular/src/app/exercise/exercise-edit/exercise-edit.component.spec.tsindex cd4711955..2afe7561c 100644--- a/angular/src/app/exercise/exercise-edit/exercise-edit.component.spec.ts+++ b/angular/src/app/exercise/exercise-edit/exercise-edit.component.spec.ts@@ -5,6 +5,7 @@ import {WeightService} from '../../weight/weight.service';import {ExerciseService} from '../exercise.service';import {Category} from '../models/exercises/category.model';import {Exercise} from '../models/exercises/exercise.model';+import {exercise1} from '../test-data/exercise';import { ExerciseEditComponent } from './exercise-edit.component';@@ -24,19 +25,7 @@ describe('ExerciseEditComponent', () => {beforeEach(() => {fixture = TestBed.createComponent(ExerciseEditComponent);component = fixture.componentInstance;- component.exercise = new Exercise(1,- 'abcd',- 'Cool exercise',- new Date(2021, 5, 10),- 'Take the weight, move it. ',- 1,- [1, 2, 3],- [5, 6],- [1, 8],- 2,- 'author',- [2])- component.exercise.category = new Category(1, 'Arms');+ component.exercise = exercise1;fixture.detectChanges();});diff --git a/angular/src/app/exercise/test-data/exercise.ts b/angular/src/app/exercise/test-data/exercise.tsnew file mode 100644index 000000000..3bea68ef4--- /dev/null+++ b/angular/src/app/exercise/test-data/exercise.ts@@ -0,0 +1,40 @@+/*+ * This file is part of wger Workout Manager <https://github.com/wger-project>.+ * Copyright (C) 2020, 2021 wger Team+ *+ * wger Workout Manager is free software: you can redistribute it and/or modify+ * it under the terms of the GNU Affero General Public License as published by+ * the Free Software Foundation, either version 3 of the License, or+ * (at your option) any later version.+ *+ * wger Workout Manager is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * GNU Affero General Public License for more details.+ *+ * You should have received a copy of the GNU Affero General Public License+ * along with this program. If not, see <http://www.gnu.org/licenses/>.+ */++import {Category} from '../models/exercises/category.model';+import {Exercise} from '../models/exercises/exercise.model';++export const category1 = new Category(1, 'Arms');+export const category2 = new Category(2, 'Back');+export const category3 = new Category(3, 'Legs');+++export const exercise1 = new Exercise(1,+ 'abcd',+ 'Cool exercise',+ new Date(2021, 5, 10),+ 'Take the weight, move it. ',+ 1,+ [1, 2, 3],+ [5, 6],+ [1, 8],+ 2,+ 'author',+ [2]);++exercise1.category = category1;diff --git a/angular/src/app/weight/test-data/weight.ts b/angular/src/app/weight/test-data/weight.tsnew file mode 100644index 000000000..152927f51--- /dev/null+++ b/angular/src/app/weight/test-data/weight.ts@@ -0,0 +1,23 @@+/*+ * This file is part of wger Workout Manager <https://github.com/wger-project>.+ * Copyright (C) 2020, 2021 wger Team+ *+ * wger Workout Manager is free software: you can redistribute it and/or modify+ * it under the terms of the GNU Affero General Public License as published by+ * the Free Software Foundation, either version 3 of the License, or+ * (at your option) any later version.+ *+ * wger Workout Manager is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ * GNU Affero General Public License for more details.+ *+ * You should have received a copy of the GNU Affero General Public License+ * along with this program. If not, see <http://www.gnu.org/licenses/>.+ */++import {WeightEntry} from '../models/weight.model';++export const weightEntry1 = new WeightEntry(new Date(2021, 6, 1), 85, 1);+export const weightEntry2 = new WeightEntry(new Date(2021, 6, 10), 82, 2);+export const weightEntry3 = new WeightEntry(new Date(2021, 6, 20), 81.2, 3);diff --git a/angular/src/app/weight/weight-detail/weight-detail.component.spec.ts b/angular/src/app/weight/weight-detail/weight-detail.component.spec.tsindex f3aa65af4..7945ef70b 100644--- a/angular/src/app/weight/weight-detail/weight-detail.component.spec.ts+++ b/angular/src/app/weight/weight-detail/weight-detail.component.spec.ts@@ -1,6 +1,6 @@import {HttpClientTestingModule} from '@angular/common/http/testing';import { ComponentFixture, TestBed } from '@angular/core/testing';-import {WeightEntry} from '../models/weight.model';+import {weightEntry1} from '../test-data/weight';import {WeightService} from '../weight.service';import { WeightDetailComponent } from './weight-detail.component';@@ -22,7 +22,7 @@ describe('WeightDetailComponent', () => {fixture = TestBed.createComponent(WeightDetailComponent);component = fixture.componentInstance;- component.entry = new WeightEntry(new Date(2021, 7, 10), 100, 1);+ component.entry = weightEntry1;component.weightDiff = -1;component.dayDiff = 2;fixture.detectChanges();