Skip to content

Commit 696e267

Browse files
authored
chore: fixes ng test setup (#9)
1 parent b289e2f commit 696e267

40 files changed

+281
-245
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,5 @@ npm-debug.log*
3030
/platforms
3131
/plugins
3232
/www
33+
34+
.devcontainer/

package.json

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212
"test": "ng test",
1313
"lint": "ng lint",
1414
"e2e": "ng e2e",
15-
"deploy:dev": "ionic build --prod && rsync -zrvh ./www/* node-development:/var/www/stop-motion-app/",
16-
"update-ng": "ng update @angular/core@17 @angular/cli@17"
15+
"deploy:dev": "ionic build --prod && rsync -zrvh ./www/* node-development:/var/www/stop-motion-app/"
1716
},
1817
"private": true,
1918
"dependencies": {
@@ -58,17 +57,16 @@
5857
"eslint-plugin-import": "2.22.1",
5958
"eslint-plugin-jsdoc": "30.7.6",
6059
"eslint-plugin-prefer-arrow": "1.2.2",
61-
"jasmine-core": "3.8.0",
62-
"jasmine-spec-reporter": "5.0.0",
63-
"karma": "6.3.2",
64-
"karma-chrome-launcher": "3.1.0",
65-
"karma-coverage": "2.0.3",
66-
"karma-coverage-istanbul-reporter": "3.0.2",
67-
"karma-jasmine": "4.0.0",
68-
"karma-jasmine-html-reporter": "1.5.0",
60+
"jasmine-core": "5.1.2",
61+
"jasmine-spec-reporter": "7.0.0",
62+
"karma": "6.4.3",
63+
"karma-chrome-launcher": "3.2.0",
64+
"karma-coverage": "2.2.1",
65+
"karma-jasmine": "5.1.0",
66+
"karma-jasmine-html-reporter": "2.1.0",
6967
"protractor": "7.0.0",
7068
"ts-node": "8.3.0",
7169
"typescript": "5.4.5"
7270
},
7371
"description": "An Ionic project"
74-
}
72+
}

src/app/app.component.spec.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,16 @@ import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
22
import { TestBed, waitForAsync } from '@angular/core/testing';
33

44
import { AppComponent } from './app.component';
5+
import { TranslateModule } from '@ngx-translate/core';
6+
import { ServiceWorkerModule } from '@angular/service-worker';
57

68
describe('AppComponent', () => {
79

810
beforeEach(waitForAsync(() => {
911

1012
TestBed.configureTestingModule({
1113
declarations: [AppComponent],
14+
imports: [TranslateModule.forRoot(), ServiceWorkerModule.register('', {enabled: false})],
1215
schemas: [CUSTOM_ELEMENTS_SCHEMA],
1316
}).compileComponents();
1417
}));

src/app/components/countdown/countdown.component.spec.ts

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

33
import { CountdownComponent } from './countdown.component';
4+
import { TranslateModule } from '@ngx-translate/core';
45

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

910
beforeEach(async(() => {
1011
TestBed.configureTestingModule({
11-
declarations: [ CountdownComponent ]
12+
declarations: [ CountdownComponent ],
13+
imports: [TranslateModule.forRoot()]
1214
})
1315
.compileComponents();
1416
}));

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { IonicModule } from '@ionic/angular';
44
import { BaseService } from '@services/base/base.service';
55

66
import { HeaderComponent } from './header.component';
7+
import { TranslateModule } from '@ngx-translate/core';
78

89
describe('HeaderComponent', () => {
910
let component: HeaderComponent;
@@ -12,7 +13,7 @@ describe('HeaderComponent', () => {
1213
beforeEach((() => {
1314
TestBed.configureTestingModule({
1415
declarations: [ HeaderComponent ],
15-
imports: [IonicModule.forRoot(), RouterTestingModule],
16+
imports: [IonicModule.forRoot(), RouterTestingModule, TranslateModule.forRoot()],
1617
providers: [BaseService]
1718
})
1819
.compileComponents();
@@ -21,6 +22,7 @@ describe('HeaderComponent', () => {
2122
beforeEach(() => {
2223
fixture = TestBed.createComponent(HeaderComponent);
2324
component = fixture.componentInstance;
25+
component.options = {backButton: false, backHref: "", title: "", leftButton: false, leftHref: "", leftIcon: "", rightButton: false, rightHref: "", rightIcon: ""};
2426
fixture.detectChanges();
2527
});
2628

src/app/components/spinner/spinner.component.spec.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { IonicModule } from '@ionic/angular';
44
import { BaseService } from '@services/base/base.service';
55

66
import { SpinnerComponent } from './spinner.component';
7+
import { TranslateModule } from '@ngx-translate/core';
78

89
describe('SpinnerComponent', () => {
910
let component: SpinnerComponent;
@@ -12,7 +13,7 @@ describe('SpinnerComponent', () => {
1213
beforeEach((() => {
1314
TestBed.configureTestingModule({
1415
declarations: [ SpinnerComponent ],
15-
imports: [IonicModule.forRoot(), RouterTestingModule],
16+
imports: [IonicModule.forRoot(), RouterTestingModule, TranslateModule.forRoot()],
1617
providers: [BaseService]
1718
})
1819
.compileComponents();
@@ -21,6 +22,7 @@ describe('SpinnerComponent', () => {
2122
beforeEach(() => {
2223
fixture = TestBed.createComponent(SpinnerComponent);
2324
component = fixture.componentInstance;
25+
component.spinnerOptions = {type: "slide"};
2426
fixture.detectChanges();
2527
});
2628

src/app/directives/open-url/open-url.directive.spec.ts

Lines changed: 0 additions & 8 deletions
This file was deleted.

src/app/pages/animator/animator.page.spec.ts

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,37 @@
11
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
22
import { IonicModule } from '@ionic/angular';
3-
3+
import { HttpClientTestingModule } from '@angular/common/http/testing';
44
import { AnimatorPage } from './animator.page';
5+
import { TranslateModule } from '@ngx-translate/core';
6+
import { ToolbarComponent } from './components/toolbar/toolbar.component';
7+
import { ThumbnailsComponent } from './components/thumbnails/thumbnails.component';
8+
import { SettingsPage } from '@pages/settings/settings.page';
9+
import { SettingsButtonComponent } from './components/settings-button/settings-button.component';
10+
import { ClearButtonComponent } from './components/clear-button/clear-button.component';
11+
import { LoadButtonComponent } from './components/load-button/load-button.component';
12+
import { SaveButtonComponent } from './components/save-button/save-button.component';
13+
import { SnapshotCanvasComponent } from './components/snapshot-canvas/snapshot-canvas.component';
14+
import { TimerComponent } from './components/timer/timer.component';
15+
import { FramerateSliderComponent } from './components/framerate-slider/framerate-slider.component';
16+
import { VideoComponent } from './components/video/video.component';
17+
import { TabbarComponent } from './components/tabbar/tabbar.component';
18+
import { CaptureButtonComponent } from './components/capture-button/capture-button.component';
19+
import { PlayerCanvasComponent } from './components/player-canvas/player-canvas.component';
20+
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
21+
import { RouterModule } from '@angular/router';
22+
import { UndoButtonComponent } from './components/undo-button/undo-button.component';
23+
import { RecordAudioButtonComponent } from './components/record-audio-button/record-audio-button.component';
24+
import { CameraSelectButtonComponent } from './components/camera-select-button/camera-select-button.component';
25+
import { PlayButtonComponent } from './components/play-button/play-button.component';
526

627
describe('AnimatorPage', () => {
728
let component: AnimatorPage;
829
let fixture: ComponentFixture<AnimatorPage>;
930

1031
beforeEach(waitForAsync(() => {
1132
TestBed.configureTestingModule({
12-
declarations: [ AnimatorPage ],
13-
imports: [IonicModule.forRoot()]
33+
declarations: [ AnimatorPage, ToolbarComponent, ThumbnailsComponent, SettingsPage, SettingsButtonComponent, ClearButtonComponent, LoadButtonComponent, SaveButtonComponent, SnapshotCanvasComponent, TimerComponent, CaptureButtonComponent, PlayerCanvasComponent, FramerateSliderComponent, VideoComponent, TabbarComponent, UndoButtonComponent, RecordAudioButtonComponent, CameraSelectButtonComponent, PlayButtonComponent],
34+
imports: [IonicModule.forRoot(), TranslateModule.forRoot(), HttpClientTestingModule, NoopAnimationsModule, RouterModule.forRoot([])]
1435
}).compileComponents();
1536

1637
fixture = TestBed.createComponent(AnimatorPage);

src/app/pages/animator/components/camera-select-button/camera-select-button.component.spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
22
import { IonicModule } from '@ionic/angular';
3-
3+
import { HttpClientTestingModule } from '@angular/common/http/testing';
44
import { CameraSelectButtonComponent } from './camera-select-button.component';
5+
import { TranslateModule } from '@ngx-translate/core';
56

67
describe('CameraSelectButtonComponent', () => {
78
let component: CameraSelectButtonComponent;
@@ -10,7 +11,7 @@ describe('CameraSelectButtonComponent', () => {
1011
beforeEach(waitForAsync(() => {
1112
TestBed.configureTestingModule({
1213
declarations: [ CameraSelectButtonComponent ],
13-
imports: [IonicModule.forRoot()]
14+
imports: [IonicModule.forRoot(), TranslateModule.forRoot(), HttpClientTestingModule]
1415
}).compileComponents();
1516

1617
fixture = TestBed.createComponent(CameraSelectButtonComponent);

src/app/pages/animator/components/capture-button/capture-button.component.spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
22
import { IonicModule } from '@ionic/angular';
3-
3+
import { HttpClientTestingModule } from '@angular/common/http/testing';
44
import { CaptureButtonComponent } from './capture-button.component';
5+
import { TranslateModule } from '@ngx-translate/core';
56

67
describe('CaptureButtonComponent', () => {
78
let component: CaptureButtonComponent;
@@ -10,7 +11,7 @@ describe('CaptureButtonComponent', () => {
1011
beforeEach(waitForAsync(() => {
1112
TestBed.configureTestingModule({
1213
declarations: [ CaptureButtonComponent ],
13-
imports: [IonicModule.forRoot()]
14+
imports: [IonicModule.forRoot(), TranslateModule.forRoot(), HttpClientTestingModule]
1415
}).compileComponents();
1516

1617
fixture = TestBed.createComponent(CaptureButtonComponent);

src/app/pages/animator/components/clear-button/clear-button.component.spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
22
import { IonicModule } from '@ionic/angular';
3-
3+
import { HttpClientTestingModule } from '@angular/common/http/testing';
44
import { ClearButtonComponent } from './clear-button.component';
5+
import { TranslateModule } from '@ngx-translate/core';
56

67
describe('ClearButtonComponent', () => {
78
let component: ClearButtonComponent;
@@ -10,7 +11,7 @@ describe('ClearButtonComponent', () => {
1011
beforeEach(waitForAsync(() => {
1112
TestBed.configureTestingModule({
1213
declarations: [ ClearButtonComponent ],
13-
imports: [IonicModule.forRoot()]
14+
imports: [IonicModule.forRoot(), TranslateModule.forRoot(), HttpClientTestingModule]
1415
}).compileComponents();
1516

1617
fixture = TestBed.createComponent(ClearButtonComponent);

src/app/pages/animator/components/framerate-slider/framerate-slider.component.spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
22
import { IonicModule } from '@ionic/angular';
3-
3+
import { HttpClientTestingModule } from '@angular/common/http/testing';
44
import { FramerateSliderComponent } from './framerate-slider.component';
5+
import { TranslateModule } from '@ngx-translate/core';
56

67
describe('FramerateSliderComponent', () => {
78
let component: FramerateSliderComponent;
@@ -10,7 +11,7 @@ describe('FramerateSliderComponent', () => {
1011
beforeEach(waitForAsync(() => {
1112
TestBed.configureTestingModule({
1213
declarations: [ FramerateSliderComponent ],
13-
imports: [IonicModule.forRoot()]
14+
imports: [IonicModule.forRoot(), TranslateModule.forRoot(), HttpClientTestingModule]
1415
}).compileComponents();
1516

1617
fixture = TestBed.createComponent(FramerateSliderComponent);

src/app/pages/animator/components/load-button/load-button.component.spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
22
import { IonicModule } from '@ionic/angular';
3-
3+
import { HttpClientTestingModule } from '@angular/common/http/testing';
44
import { LoadButtonComponent } from './load-button.component';
5+
import { TranslateModule } from '@ngx-translate/core';
56

67
describe('LoadButtonComponent', () => {
78
let component: LoadButtonComponent;
@@ -10,7 +11,7 @@ describe('LoadButtonComponent', () => {
1011
beforeEach(waitForAsync(() => {
1112
TestBed.configureTestingModule({
1213
declarations: [ LoadButtonComponent ],
13-
imports: [IonicModule.forRoot()]
14+
imports: [IonicModule.forRoot(), TranslateModule.forRoot(), HttpClientTestingModule]
1415
}).compileComponents();
1516

1617
fixture = TestBed.createComponent(LoadButtonComponent);

src/app/pages/animator/components/play-button/play-button.component.spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
22
import { IonicModule } from '@ionic/angular';
3-
3+
import { HttpClientTestingModule } from '@angular/common/http/testing';
44
import { PlayButtonComponent } from './play-button.component';
5+
import { TranslateModule } from '@ngx-translate/core';
56

67
describe('PlayButtonComponent', () => {
78
let component: PlayButtonComponent;
@@ -10,7 +11,7 @@ describe('PlayButtonComponent', () => {
1011
beforeEach(waitForAsync(() => {
1112
TestBed.configureTestingModule({
1213
declarations: [ PlayButtonComponent ],
13-
imports: [IonicModule.forRoot()]
14+
imports: [IonicModule.forRoot(), TranslateModule.forRoot(), HttpClientTestingModule]
1415
}).compileComponents();
1516

1617
fixture = TestBed.createComponent(PlayButtonComponent);

src/app/pages/animator/components/player-canvas/player-canvas.component.spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
22
import { IonicModule } from '@ionic/angular';
3-
3+
import { HttpClientTestingModule } from '@angular/common/http/testing';
44
import { PlayerCanvasComponent } from './player-canvas.component';
5+
import { TranslateModule } from '@ngx-translate/core';
56

67
describe('PlayerCanvasComponent', () => {
78
let component: PlayerCanvasComponent;
@@ -10,7 +11,7 @@ describe('PlayerCanvasComponent', () => {
1011
beforeEach(waitForAsync(() => {
1112
TestBed.configureTestingModule({
1213
declarations: [ PlayerCanvasComponent ],
13-
imports: [IonicModule.forRoot()]
14+
imports: [IonicModule.forRoot(), TranslateModule.forRoot(), HttpClientTestingModule]
1415
}).compileComponents();
1516

1617
fixture = TestBed.createComponent(PlayerCanvasComponent);

src/app/pages/animator/components/record-audio-button/record-audio-button.component.spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
22
import { IonicModule } from '@ionic/angular';
3-
3+
import { HttpClientTestingModule } from '@angular/common/http/testing';
44
import { RecordAudioButtonComponent } from './record-audio-button.component';
5+
import { TranslateModule } from '@ngx-translate/core';
56

67
describe('RecordAudioButtonComponent', () => {
78
let component: RecordAudioButtonComponent;
@@ -10,7 +11,7 @@ describe('RecordAudioButtonComponent', () => {
1011
beforeEach(waitForAsync(() => {
1112
TestBed.configureTestingModule({
1213
declarations: [ RecordAudioButtonComponent ],
13-
imports: [IonicModule.forRoot()]
14+
imports: [IonicModule.forRoot(), TranslateModule.forRoot(), HttpClientTestingModule]
1415
}).compileComponents();
1516

1617
fixture = TestBed.createComponent(RecordAudioButtonComponent);

src/app/pages/animator/components/save-button/save-button.component.spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
22
import { IonicModule } from '@ionic/angular';
3-
3+
import { HttpClientTestingModule } from '@angular/common/http/testing';
44
import { SaveButtonComponent } from './save-button.component';
5+
import { TranslateModule } from '@ngx-translate/core';
56

67
describe('SaveButtonComponent', () => {
78
let component: SaveButtonComponent;
@@ -10,7 +11,7 @@ describe('SaveButtonComponent', () => {
1011
beforeEach(waitForAsync(() => {
1112
TestBed.configureTestingModule({
1213
declarations: [ SaveButtonComponent ],
13-
imports: [IonicModule.forRoot()]
14+
imports: [IonicModule.forRoot(), TranslateModule.forRoot(), HttpClientTestingModule]
1415
}).compileComponents();
1516

1617
fixture = TestBed.createComponent(SaveButtonComponent);

src/app/pages/animator/components/settings-button/settings-button.component.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
22
import { IonicModule } from '@ionic/angular';
33

44
import { SettingsButtonComponent } from './settings-button.component';
5+
import { TranslateModule } from '@ngx-translate/core';
56

67
describe('SettingsButtonComponent', () => {
78
let component: SettingsButtonComponent;
@@ -10,7 +11,7 @@ describe('SettingsButtonComponent', () => {
1011
beforeEach(waitForAsync(() => {
1112
TestBed.configureTestingModule({
1213
declarations: [ SettingsButtonComponent ],
13-
imports: [IonicModule.forRoot()]
14+
imports: [IonicModule.forRoot(), TranslateModule.forRoot()]
1415
}).compileComponents();
1516

1617
fixture = TestBed.createComponent(SettingsButtonComponent);

src/app/pages/animator/components/tabbar/tabbar.component.spec.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,23 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
22
import { RouterTestingModule } from '@angular/router/testing';
33
import { IonicModule } from '@ionic/angular';
44
import { BaseService } from '@services/base/base.service';
5-
5+
import { HttpClientTestingModule } from '@angular/common/http/testing';
66
import { TabbarComponent } from './tabbar.component';
7+
import { PlayButtonComponent } from '../play-button/play-button.component';
8+
import { UndoButtonComponent } from '../undo-button/undo-button.component';
9+
import { CaptureButtonComponent } from '../capture-button/capture-button.component';
10+
import { RecordAudioButtonComponent } from '../record-audio-button/record-audio-button.component';
11+
import { TranslateModule } from '@ngx-translate/core';
12+
import { CameraSelectButtonComponent } from '../camera-select-button/camera-select-button.component';
713

814
describe('HeaderComponent', () => {
915
let component: TabbarComponent;
1016
let fixture: ComponentFixture<TabbarComponent>;
1117

1218
beforeEach((() => {
1319
TestBed.configureTestingModule({
14-
declarations: [ TabbarComponent ],
15-
imports: [IonicModule.forRoot(), RouterTestingModule],
20+
declarations: [ TabbarComponent, PlayButtonComponent, UndoButtonComponent, CaptureButtonComponent, RecordAudioButtonComponent, CameraSelectButtonComponent ],
21+
imports: [IonicModule.forRoot(), RouterTestingModule, TranslateModule.forRoot(), HttpClientTestingModule],
1622
providers: [BaseService]
1723
})
1824
.compileComponents();

0 commit comments

Comments
 (0)