Skip to content

Commit fc881c8

Browse files
WIP fixing tests
1 parent 897e797 commit fc881c8

File tree

88 files changed

+503
-472
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+503
-472
lines changed

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

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { ComponentFixture, TestBed, async } from '@angular/core/testing';
2-
import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
3-
import { MatSnackBar, MatSnackBarModule } from '@angular/material/snack-bar';
1+
import { ComponentFixture, TestBed } from '@angular/core/testing';
2+
import { HttpClientTestingModule } from '@angular/common/http/testing';
3+
import { MatSnackBarModule } from '@angular/material/snack-bar';
44

55
import { Angulartics2Module } from 'angulartics2';
66
import { AppComponent } from './app.component';
@@ -9,6 +9,7 @@ import { ConnectionsService } from './services/connections.service';
99
import { MatDialogModule } from '@angular/material/dialog';
1010
import { MatMenuModule } from '@angular/material/menu';
1111
import { RouterTestingModule } from '@angular/router/testing';
12+
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
1213

1314
describe('AppComponent', () => {
1415
let app: AppComponent;
@@ -37,19 +38,20 @@ describe('AppComponent', () => {
3738
"externalRegistrationProvider": null
3839
}
3940

40-
beforeEach(async(() => {
41-
TestBed.configureTestingModule({
42-
imports: [
41+
beforeEach(async () => {
42+
await TestBed.configureTestingModule({
43+
imports: [
4344
RouterTestingModule,
4445
HttpClientTestingModule,
4546
MatSnackBarModule,
4647
MatDialogModule,
4748
MatMenuModule,
4849
Angulartics2Module.forRoot(),
49-
AppComponent
50-
],
51-
}).compileComponents();
52-
}));
50+
AppComponent,
51+
BrowserAnimationsModule
52+
],
53+
}).compileComponents();
54+
});
5355

5456
beforeEach(() => {
5557
fixture = TestBed.createComponent(AppComponent);

frontend/src/app/auth.guard.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { TestBed, async, inject } from '@angular/core/testing';
1+
import { TestBed, inject } from '@angular/core/testing';
22

33
import { AuthGuard } from './auth.guard';
44
import { RouterTestingModule } from '@angular/router/testing';

frontend/src/app/components/audit/audit.component.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Component, OnDestroy, OnInit, ViewChild } from '@angular/core';
2-
import { AsyncPipe, NgClass } from '@angular/common';
2+
import { AsyncPipe, NgClass, NgForOf, NgIf } from '@angular/common';
33
import { Subscription, merge } from 'rxjs';
44

55
import { Angulartics2OnModule } from 'angulartics2';
@@ -32,6 +32,8 @@ import { PlaceholderTableDataComponent } from '../skeletons/placeholder-table-da
3232
selector: 'app-audit',
3333
standalone: true,
3434
imports: [
35+
NgIf,
36+
NgForOf,
3537
NgClass,
3638
AsyncPipe,
3739
MatFormFieldModule,
@@ -46,7 +48,7 @@ import { PlaceholderTableDataComponent } from '../skeletons/placeholder-table-da
4648
PlaceholderTableDataComponent
4749
],
4850
templateUrl: './audit.component.html',
49-
styleUrls: ['./audit.component.scss']
51+
styleUrls: ['./audit.component.css']
5052
})
5153
export class AuditComponent implements OnInit, OnDestroy {
5254
public isSaas = (environment as any).saas;

frontend/src/app/components/company/invite-member-dialog/invite-member-dialog.component.spec.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { MatSnackBarModule } from '@angular/material/snack-bar';
66
import { FormsModule } from '@angular/forms';
77
import { Angulartics2Module } from 'angulartics2';
88
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
9+
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
910

1011
describe('AddMemberDialogComponent', () => {
1112
let component: InviteMemberDialogComponent;
@@ -18,7 +19,8 @@ describe('AddMemberDialogComponent', () => {
1819
MatSnackBarModule,
1920
FormsModule,
2021
Angulartics2Module.forRoot(),
21-
InviteMemberDialogComponent
22+
InviteMemberDialogComponent,
23+
BrowserAnimationsModule
2224
],
2325
providers: [
2426
{ provide: MAT_DIALOG_DATA, useValue: { id: '', connections: [] } },

frontend/src/app/components/connect-db/connect-db.component.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { AlertActionType, AlertType } from 'src/app/models/alert';
2-
import { ComponentFixture, TestBed, async } from '@angular/core/testing';
2+
import { ComponentFixture, TestBed } from '@angular/core/testing';
33
import { ConnectionType, DBtype } from 'src/app/models/connection';
44
import { FormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';
55
import { MatDialog, MatDialogModule } from '@angular/material/dialog';
@@ -20,7 +20,7 @@ import { RouterTestingModule } from "@angular/router/testing";
2020
import { forwardRef } from '@angular/core';
2121
import { of } from 'rxjs';
2222

23-
describe('ConnectDBComponent', () => {
23+
fdescribe('ConnectDBComponent', () => {
2424
let component: ConnectDBComponent;
2525
let fixture: ComponentFixture<ConnectDBComponent>;
2626
let dialog: MatDialog;

frontend/src/app/components/connect-db/connect-db.component.ts

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,9 @@ export class ConnectDBComponent implements OnInit, OnDestroy {
7373

7474
public isSaas = (environment as any).saas;
7575
public connectionID: string | null = null;
76-
// public isMasterKeyTurnedOn: boolean = false;
7776
public masterKey: string;
7877
public connectionToken: string | null = null;
7978
public submitting: boolean = false;
80-
// public userOS = null;
8179
public otherOS = [];
8280
public warning: Alert = {
8381
id: 10000000,
@@ -95,12 +93,6 @@ export class ConnectDBComponent implements OnInit, OnDestroy {
9593
[DBtype.DB2]: '50000'
9694
}
9795

98-
// public osAgents = {
99-
// Mac: 'https://github.com/rocket-admin/rocketadmin-cli/releases/download/latest/rocketadmin-cli-macos',
100-
// Windows: 'https://github.com/rocket-admin/rocketadmin-cli/releases/download/latest/rocketadmin-cli-windows.exe',
101-
// Linux: 'https://github.com/rocket-admin/rocketadmin-cli/releases/download/latest/rocketadmin-cli-linux'
102-
// }
103-
10496
private getTitleSubscription: Subscription;
10597

10698
constructor(
@@ -116,19 +108,11 @@ export class ConnectDBComponent implements OnInit, OnDestroy {
116108

117109
ngOnInit() {
118110
this.connectionID = this._connections.currentConnectionID;
119-
// this.isMasterKeyTurnedOn = this._connections.currentConnection.masterEncryption;
120111

121112
if (this.connectionID) this.getTitleSubscription = this._connections.getCurrentConnectionTitle().subscribe(connectionTitle => {
122113
this.title.setTitle(`Edit connection ${connectionTitle} | Rocketadmin`);
123114
});
124115

125-
// if (navigator.appVersion.indexOf("Win") != -1) this.userOS = "Windows";
126-
// if (navigator.appVersion.indexOf("Mac") != -1) this.userOS = "Mac";
127-
// if (navigator.appVersion.indexOf("Linux") != -1) this.userOS = "Linux";
128-
// if (this.userOS === null) this.userOS = "Linux";
129-
130-
// this.otherOS = Object.keys(this.osAgents).filter(os => os !== this.userOS);
131-
132116
if (!this.connectionID) {
133117
this._user.sendUserAction('CONNECTION_CREATION_NOT_FINISHED').subscribe();
134118
if (this.isSaas) {
@@ -174,8 +158,6 @@ export class ConnectDBComponent implements OnInit, OnDestroy {
174158
action: (id: number) => this._notifications.dismissAlert()
175159
}
176160
]);
177-
//@ts-ignore
178-
// Intercom('show');
179161
};
180162
},
181163
() => {this.submitting = false},
@@ -252,8 +234,6 @@ export class ConnectDBComponent implements OnInit, OnDestroy {
252234
}
253235
});
254236
this.submitting = false;
255-
//@ts-ignore
256-
// Intercom('show');
257237
}
258238

259239
handleCredentialsSubmitting(connectForm: NgForm) {
@@ -284,9 +264,6 @@ export class ConnectDBComponent implements OnInit, OnDestroy {
284264
}
285265

286266
createConnection(connectForm: NgForm) {
287-
// if (connectForm.form.vald) {
288-
289-
// }
290267
if (this.db.connectionType === 'direct') {
291268
const ipAddressDilaog = this.dialog.open(DbConnectionIpAccessDialogComponent, {
292269
width: '36em',
@@ -351,8 +328,4 @@ export class ConnectDBComponent implements OnInit, OnDestroy {
351328
handleMasterKeyChange(newMasterKey: string): void {
352329
this.masterKey = newMasterKey;
353330
}
354-
355-
// handleMasterKeyToggle(isTurnedOn: boolean): void {
356-
// this.isMasterKeyTurnedOn = isTurnedOn;
357-
// }
358331
}

frontend/src/app/components/connect-db/db-connection-confirm-dialog/db-connection-confirm-dialog.component.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@ import { Router } from '@angular/router';
55
import { ConnectionsService } from 'src/app/services/connections.service';
66
import { DbConnectionDeleteDialogComponent } from '../db-connection-delete-dialog/db-connection-delete-dialog.component';
77
import { environment } from 'src/environments/environment';
8+
import { NgIf } from '@angular/common';
89

910
@Component({
1011
selector: 'app-db-connection-confirm-dialog',
1112
templateUrl: './db-connection-confirm-dialog.component.html',
1213
styleUrls: ['./db-connection-confirm-dialog.component.css'],
1314
imports: [
15+
NgIf,
1416
MatDialogModule,
1517
MatButtonModule
1618
]

frontend/src/app/components/connect-db/db-connection-delete-dialog/db-connection-delete-dialog.component.spec.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Angulartics2, Angulartics2Module } from 'angulartics2';
2-
import { ComponentFixture, TestBed, async } from '@angular/core/testing';
3-
import { MAT_DIALOG_DATA, MatDialog, MatDialogModule, MatDialogRef } from '@angular/material/dialog';
2+
import { ComponentFixture, TestBed } from '@angular/core/testing';
3+
import { MAT_DIALOG_DATA, MatDialogModule, MatDialogRef } from '@angular/material/dialog';
44

55
import { ConnectionsService } from 'src/app/services/connections.service';
66
import { DbConnectionDeleteDialogComponent } from './db-connection-delete-dialog.component';
@@ -22,10 +22,10 @@ xdescribe('DbConnectionDeleteDialogComponent', () => {
2222
close: () => { }
2323
};
2424

25-
beforeEach(async((): void => {
25+
beforeEach(async (): Promise<void> => {
2626
routerSpy = {navigate: jasmine.createSpy('navigate')};
2727

28-
TestBed.configureTestingModule({
28+
await TestBed.configureTestingModule({
2929
imports: [
3030
HttpClientTestingModule,
3131
RouterTestingModule.withRoutes([]),
@@ -46,9 +46,8 @@ xdescribe('DbConnectionDeleteDialogComponent', () => {
4646
},
4747
Angulartics2
4848
],
49-
})
50-
.compileComponents();
51-
}));
49+
}).compileComponents();
50+
});
5251

5352
beforeEach(() => {
5453
fixture = TestBed.createComponent(DbConnectionDeleteDialogComponent);

frontend/src/app/components/connect-db/db-connection-ip-access-dialog/db-connection-ip-access-dialog.component.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,15 @@ import googlIPsList from 'src/app/consts/google-IP-addresses';
1010
import * as ipaddr from 'ipaddr.js';
1111
import isIP from 'validator/lib/isIP';
1212
import { IpAddressButtonComponent } from '../../ui-components/ip-address-button/ip-address-button.component';
13+
import { NgIf } from '@angular/common';
1314

1415
@Component({
1516
selector: 'app-db-connection-ip-access-dialog',
1617
templateUrl: './db-connection-ip-access-dialog.component.html',
1718
styleUrls: ['./db-connection-ip-access-dialog.component.css'],
1819
standalone: true,
1920
imports: [
21+
NgIf,
2022
MatDialogModule,
2123
MatButtonModule,
2224
MatIconModule,

frontend/src/app/components/connect-db/db-credentials-forms/db2-credentials-form/db2-credentials-form.component.spec.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,23 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
33
import { Db2CredentialsFormComponent } from './db2-credentials-form.component';
44
import { FormsModule } from '@angular/forms';
55
import { MatCheckboxModule } from '@angular/material/checkbox';
6+
import { Angulartics2Module } from 'angulartics2';
7+
import { HttpClientTestingModule } from '@angular/common/http/testing';
8+
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
69

7-
fdescribe('Db2CredentialsFormComponent', () => {
10+
describe('Db2CredentialsFormComponent', () => {
811
let component: Db2CredentialsFormComponent;
912
let fixture: ComponentFixture<Db2CredentialsFormComponent>;
1013

1114
beforeEach(async () => {
1215
await TestBed.configureTestingModule({
1316
imports: [
17+
HttpClientTestingModule,
1418
FormsModule,
1519
MatCheckboxModule,
16-
Db2CredentialsFormComponent
20+
Db2CredentialsFormComponent,
21+
BrowserAnimationsModule,
22+
Angulartics2Module.forRoot()
1723
]
1824
})
1925
.compileComponents();

0 commit comments

Comments
 (0)