Upgrade UI dependencies (#16233)

Signed-off-by: AllForNothing <sshijun@vmware.com>
This commit is contained in:
孙世军 2022-01-17 14:20:20 +08:00 committed by GitHub
parent cc1a204a6b
commit 8f77567589
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
126 changed files with 5795 additions and 14535 deletions

1
.gitignore vendored
View File

@ -38,6 +38,7 @@ src/portal/src/**/*.js.map
src/portal/src/lib/coverage
src/portal/ng-swagger-gen
src/portal/docker-build/nginx.conf
src/portal/.angular
**/npm*.log
**/*ngsummary.json

View File

@ -1,6 +1,6 @@
ARG harbor_base_image_version
ARG harbor_base_namespace
FROM node:16.5.0 as nodeportal
FROM node:16.10.0 as nodeportal
WORKDIR /build_dir

View File

@ -46,24 +46,24 @@
"private": true,
"dependencies": {
// Angular framework. Required
"@angular/animations": "~12.2.11",
"@angular/common": "~12.2.11",
"@angular/compiler": "~12.2.11",
"@angular/core": "~12.2.11",
"@angular/forms": "~12.2.11",
"@angular/localize": "~12.2.11",
"@angular/platform-browser": "~12.2.11",
"@angular/platform-browser-dynamic": "~12.2.11",
"@angular/router": "~12.2.11",
"rxjs": "^6.6.7",
"@angular/animations": "~13.1.1",
"@angular/common": "~13.1.1",
"@angular/compiler": "~13.1.1",
"@angular/core": "~13.1.1",
"@angular/forms": "~13.1.1",
"@angular/localize": "~13.1.1",
"@angular/platform-browser": "~13.1.1",
"@angular/platform-browser-dynamic": "~13.1.1",
"@angular/router": "~13.1.1",
"rxjs": "^7.4.0",
"tslib": "^2.2.0",
"zone.js": "~0.11.4",
// Clarity UI. Required
"@cds/core": "~5.5.8",
"@clr/angular": "~12.0.6",
"@clr/icons": "~12.0.6",
"@clr/ui": "~12.0.6",
"@cds/core": "next",
"@clr/angular": "next",
"@clr/icons": "next",
"@clr/ui": "next",
// For Harbor i18n functionality. Required
"@ngx-translate/core": "^13.0.0",
@ -79,10 +79,10 @@
"ngx-cookie": "^5.0.2",
// To render markdown data. Required
"ngx-markdown": "~12.0.1",
"ngx-markdown": "~13.0.0",
// For swagger API center. Required
"swagger-ui": "^3.52.5",
"swagger-ui": "^4.1.3",
"buffer": "^6.0.3",
// To convert yaml to json. Required
@ -90,21 +90,21 @@
},
"devDependencies": {
// Angular framework. Required
"@angular-devkit/build-angular": "~12.2.11",
"@angular/cli": "~12.2.11",
"@angular/compiler-cli": "~12.2.11",
"@angular-devkit/build-angular": "~13.2.0-next.2",
"@angular/cli": "~13.1.1",
"@angular/compiler-cli": "~13.1.1",
"@types/jasmine": "~3.10.1",
"@types/node": "^16.11.6",
"typescript": "~4.3.5",
"typescript": "~4.5.4",
// For unit test. Required
"jasmine-core": "^3.7.1",
"jasmine-core": "^4.0.0",
"jasmine-spec-reporter": "~7.0.0",
"karma": "^6.3.3",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "^2.0.3",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "^1.5.0",
"karma-coverage": "^2.1.0",
"karma-jasmine": "~4.0.1",
"karma-jasmine-html-reporter": "^1.7.0",
// To run a local mocked API server. Required
"@types/express": "^4.17.12",

View File

@ -1,4 +1,4 @@
FROM node:16.5.0 as builder
FROM node:16.10.0 as builder
WORKDIR /build_dir

File diff suppressed because it is too large Load Diff

View File

@ -25,51 +25,51 @@
},
"private": true,
"dependencies": {
"@angular/animations": "~12.2.11",
"@angular/common": "~12.2.11",
"@angular/compiler": "~12.2.11",
"@angular/core": "~12.2.11",
"@angular/forms": "~12.2.11",
"@angular/localize": "~12.2.11",
"@angular/platform-browser": "~12.2.11",
"@angular/platform-browser-dynamic": "~12.2.11",
"@angular/router": "~12.2.11",
"rxjs": "^6.6.7",
"@angular/animations": "~13.1.1",
"@angular/common": "~13.1.1",
"@angular/compiler": "~13.1.1",
"@angular/core": "~13.1.1",
"@angular/forms": "~13.1.1",
"@angular/localize": "~13.1.1",
"@angular/platform-browser": "~13.1.1",
"@angular/platform-browser-dynamic": "~13.1.1",
"@angular/router": "~13.1.1",
"rxjs": "^7.4.0",
"tslib": "^2.2.0",
"zone.js": "~0.11.4",
"@cds/core": "~5.5.8",
"@clr/angular": "~12.0.6",
"@clr/icons": "~12.0.6",
"@clr/ui": "~12.0.6",
"@clr/angular": "next",
"@cds/core": "next",
"@clr/icons": "next",
"@clr/ui": "next",
"@ngx-translate/core": "^13.0.0",
"@ngx-translate/http-loader": "^6.0.0",
"cron-validator": "^1.2.1",
"ngx-clipboard": "^12.3.1",
"ngx-cookie": "^5.0.2",
"ngx-markdown": "~12.0.1",
"swagger-ui": "^3.52.5",
"ngx-markdown": "~13.0.0",
"swagger-ui": "^4.1.3",
"buffer": "^6.0.3",
"js-yaml": "^4.1.0"
},
"devDependencies": {
"@angular-devkit/build-angular": "~12.2.11",
"@angular/cli": "~12.2.11",
"@angular/compiler-cli": "~12.2.11",
"@angular-devkit/build-angular": "~13.2.0-next.2",
"@angular/cli": "~13.1.1",
"@angular/compiler-cli": "~13.1.1",
"@types/express": "^4.17.12",
"@types/jasmine": "~3.10.1",
"@types/node": "^16.11.6",
"codelyzer": "^6.0.2",
"express": "^4.17.1",
"jasmine-core": "^3.7.1",
"jasmine-spec-reporter": "~7.0.0",
"jasmine-core": "^4.0.0",
"jasmine-spec-reporter": "^7.0.0",
"karma": "^6.3.3",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "^2.0.3",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "^1.5.0",
"karma-coverage": "^2.1.0",
"karma-jasmine": "~4.0.1",
"karma-jasmine-html-reporter": "^1.7.0",
"ng-swagger-gen": "^1.8.1",
"protractor": "^7.0.0",
"eslint": "8.1.0",
"typescript": "~4.3.5"
"typescript": "~4.5.4"
}
}

View File

@ -1,4 +1,4 @@
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { SignInComponent } from './sign-in.component';
import { AppConfigService } from '../../services/app-config.service';
import { SessionService } from '../../shared/services/session.service';
@ -26,8 +26,8 @@ describe('SignInComponent', () => {
clearPermissionCache() {
}
};
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [
SharedTestingModule
],
@ -69,7 +69,7 @@ describe('SignInComponent', () => {
],
schemas: [CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA]
}).compileComponents();
}));
});
beforeEach(() => {
fixture = TestBed.createComponent(SignInComponent);

View File

@ -1,15 +1,10 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { TranslateModule, TranslateService } from '@ngx-translate/core';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { TopRepoComponent } from './top-repo.component';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { BrowserAnimationsModule, NoopAnimationsModule } from '@angular/platform-browser/animations';
import { ClarityModule } from '@clr/angular';
import { FormsModule } from '@angular/forms';
import { RouterTestingModule } from '@angular/router/testing';
import { of } from 'rxjs';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { MessageHandlerService } from '../../../shared/services/message-handler.service';
import { TopRepoService } from './top-repository.service';
import { SharedTestingModule } from '../../../shared/shared.module';
describe('TopRepoComponent', () => {
let component: TopRepoComponent;
@ -22,30 +17,22 @@ describe('TopRepoComponent', () => {
const mockTopRepoService = {
getTopRepos: () => of([])
};
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
beforeEach(async () => {
await TestBed.configureTestingModule({
schemas: [
CUSTOM_ELEMENTS_SCHEMA
],
imports: [
BrowserAnimationsModule,
ClarityModule,
TranslateModule.forRoot(),
FormsModule,
RouterTestingModule,
NoopAnimationsModule,
HttpClientTestingModule
SharedTestingModule
],
declarations: [TopRepoComponent],
providers: [
TranslateService,
{ provide: TopRepoService, useValue: mockTopRepoService },
{ provide: MessageHandlerService, useValue: mockMessageHandlerService },
]
})
.compileComponents();
}));
}).compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(TopRepoComponent);

View File

@ -1,4 +1,4 @@
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { UserService } from '../../base/left-side-nav/user/user.service';
import { TranslateModule, TranslateService } from '@ngx-translate/core';
@ -15,8 +15,8 @@ describe('SignUpPageComponent', () => {
let fakeUserService = null;
let fakeSessionService = null;
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [SignUpPageComponent, NewUserFormComponent],
imports: [
FormsModule,
@ -31,7 +31,7 @@ describe('SignUpPageComponent', () => {
],
schemas: [CUSTOM_ELEMENTS_SCHEMA]
}).compileComponents();
}));
});
beforeEach(() => {
fixture = TestBed.createComponent(SignUpPageComponent);

View File

@ -1,16 +1,12 @@
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { ClarityModule } from "@clr/angular";
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { SignUpComponent } from './sign-up.component';
import { SessionService } from '../../shared/services/session.service';
import { UserService } from '../../base/left-side-nav/user/user.service';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { TranslateModule, TranslateService } from '@ngx-translate/core';
import { NewUserFormComponent } from '../../shared/components/new-user-form/new-user-form.component';
import { FormsModule } from '@angular/forms';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { of } from 'rxjs';
import { ErrorHandler } from '../../shared/units/error-handler';
import { InlineAlertComponent } from "../../shared/components/inline-alert/inline-alert.component";
import { SharedTestingModule } from '../../shared/shared.module';
describe('SignUpComponent', () => {
let component: SignUpComponent;
@ -36,24 +32,19 @@ describe('SignUpComponent', () => {
creation_time: 'string',
update_time: 'string',
};
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [SignUpComponent, NewUserFormComponent, InlineAlertComponent],
imports: [
FormsModule,
ClarityModule,
TranslateModule.forRoot(),
BrowserAnimationsModule
SharedTestingModule
],
providers: [
TranslateService,
{ provide: SessionService, useValue: fakeSessionService },
{ provide: UserService, useValue: fakeUserService },
ErrorHandler
],
schemas: [CUSTOM_ELEMENTS_SCHEMA]
}).compileComponents();
}));
});
beforeEach(() => {
fixture = TestBed.createComponent(SignUpComponent);

View File

@ -13,15 +13,13 @@
// limitations under the License.
/* tslint:disable:no-unused-variable */
import { TestBed, waitForAsync, ComponentFixture } from '@angular/core/testing';
import { TestBed, ComponentFixture } from '@angular/core/testing';
import { Title } from '@angular/platform-browser';
import { TranslateModule, TranslateService } from '@ngx-translate/core';
import { CookieService } from 'ngx-cookie';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { SessionService } from './shared/services/session.service';
import { AppConfigService } from './services/app-config.service';
import { AppComponent } from './app.component';
import { ClarityModule } from "@clr/angular";
import { APP_BASE_HREF } from "@angular/common";
import { SharedTestingModule } from "./shared/shared.module";
import { SkinableConfig } from "./services/skinable-config.service";
@ -94,9 +92,9 @@ describe('AppComponent', () => {
fixture.destroy();
});
it('should create the app', waitForAsync(() => {
it('should create the app', () => {
expect(compiled).toBeTruthy();
}));
});
});

View File

@ -1,4 +1,4 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { AccountSettingsModalComponent } from './account-settings-modal.component';
import { SessionService } from "../../shared/services/session.service";
@ -66,8 +66,8 @@ describe('AccountSettingsModalComponent', () => {
navigate: () => { }
};
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [AccountSettingsModalComponent, InlineAlertComponent, ConfirmationDialogComponent],
imports: [
RouterTestingModule,
@ -90,8 +90,8 @@ describe('AccountSettingsModalComponent', () => {
schemas: [
CUSTOM_ELEMENTS_SCHEMA
],
});
}));
}).compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(AccountSettingsModalComponent);
@ -108,7 +108,7 @@ describe('AccountSettingsModalComponent', () => {
it('should create', () => {
expect(component).toBeTruthy();
});
it('should input right email', waitForAsync(async () => {
it('should input right email', async () => {
await fixture.whenStable();
// Update the title input
userExisting = true;
@ -126,7 +126,7 @@ describe('AccountSettingsModalComponent', () => {
emailInput.value = '123@qq.com';
emailInput.dispatchEvent(new Event('blur'));
expect(emailInput.value).toEqual('123@qq.com');
}));
});
it('should update settings', async () => {
await fixture.whenStable();
@ -218,6 +218,5 @@ describe('AccountSettingsModalComponent', () => {
component.confirmGenerate(null);
await fixture.whenStable();
expect(component.showGenerateCli).toEqual(false);
});
});

View File

@ -1,4 +1,4 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { TranslateModule, TranslateService } from '@ngx-translate/core';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { BrowserAnimationsModule, NoopAnimationsModule } from '@angular/platform-browser/animations';
@ -22,8 +22,8 @@ describe('ConfirmationDialogComponent', () => {
cancel: () => { },
confirm: () => { },
};
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
beforeEach(async () => {
await TestBed.configureTestingModule({
schemas: [
CUSTOM_ELEMENTS_SCHEMA
],
@ -43,7 +43,7 @@ describe('ConfirmationDialogComponent', () => {
]
}).compileComponents();
}));
});
beforeEach(() => {
fixture = TestBed.createComponent(GlobalConfirmationDialogComponent);

View File

@ -1,4 +1,4 @@
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { SessionService } from '../../shared/services/session.service';
@ -86,8 +86,8 @@ describe('HarborShellComponent', () => {
return of([]).pipe(delay(0));
}
};
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [
RouterTestingModule,
TranslateModule.forRoot(),
@ -111,7 +111,7 @@ describe('HarborShellComponent', () => {
],
schemas: [CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA]
}).compileComponents();
}));
});
beforeEach(() => {
fixture = TestBed.createComponent(HarborShellComponent);

View File

@ -1,4 +1,4 @@
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { MessageHandlerService } from '../../../../shared/services/message-handler.service';
import { AppConfigService } from '../../../../services/app-config.service';
import { ConfigurationService } from '../../../../services/config.service';
@ -6,8 +6,6 @@ import { ConfigurationAuthComponent } from './config-auth.component';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { of } from 'rxjs';
import { SystemInfoService } from "../../../../shared/services";
import { clone } from '../../../../shared/units/utils';
import { CONFIG_AUTH_MODE } from '../../../../shared/entities/shared.const';
import { ConfigService } from "../config.service";
import { Configuration } from '../config';
import { SharedTestingModule } from "../../../../shared/shared.module";
@ -53,8 +51,8 @@ describe('ConfigurationAuthComponent', () => {
}
};
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [
SharedTestingModule
],
@ -68,7 +66,7 @@ describe('ConfigurationAuthComponent', () => {
],
schemas: [CUSTOM_ELEMENTS_SCHEMA]
}).compileComponents();
}));
});
beforeEach(() => {
fixture = TestBed.createComponent(ConfigurationAuthComponent);

View File

@ -1,4 +1,4 @@
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { ConfigurationComponent } from './config.component';
import { SharedTestingModule } from "../../../shared/shared.module";
@ -24,7 +24,7 @@ describe('ConfigurationComponent', () => {
}
};
let initSpy: jasmine.Spy;
beforeEach(waitForAsync(() => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [
SharedTestingModule
@ -35,7 +35,7 @@ describe('ConfigurationComponent', () => {
{ provide: ConfigService, useValue: fakeConfigService },
]
}).compileComponents();
}));
});
beforeEach(() => {
initSpy = spyOn(fakeConfigService, "initConfig").and.returnValue(undefined);

View File

@ -7,7 +7,7 @@ import { ConfigService } from "./config.service";
describe('ConfigService', () => {
const fakedConfigureService = {
getConfigurations() {
getConfigurations(): any {
return of(null);
}
};

View File

@ -1,9 +1,8 @@
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { MessageHandlerService } from '../../../../shared/services/message-handler.service';
import { ConfigurationService } from '../../../../services/config.service';
import { ConfigurationEmailComponent } from './config-email.component';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { clone } from '../../../../shared/units/utils';
import { of } from 'rxjs';
import { ConfigService } from "../config.service";
import { SharedTestingModule } from "../../../../shared/shared.module";
@ -38,8 +37,8 @@ describe('ConfigurationEmailComponent', () => {
resetConfig() {
}
};
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [
SharedTestingModule
],
@ -51,7 +50,7 @@ describe('ConfigurationEmailComponent', () => {
],
schemas: [CUSTOM_ELEMENTS_SCHEMA]
}).compileComponents();
}));
});
beforeEach(() => {
fixture = TestBed.createComponent(ConfigurationEmailComponent);

View File

@ -1,5 +1,5 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { TranslateModule, TranslateService } from '@ngx-translate/core';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { TranslateModule, } from '@ngx-translate/core';
import { ClarityModule } from '@clr/angular';
import { SharedTestingModule } from '../../../../shared/shared.module';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
@ -96,8 +96,8 @@ describe('DistributionInstanceComponent', () => {
}
};
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [
ClarityModule,
TranslateModule,
@ -113,7 +113,7 @@ describe('DistributionInstanceComponent', () => {
DistributionSetupModalComponent
]
}).compileComponents();
}));
});
beforeEach(() => {
fixture = TestBed.createComponent(DistributionInstancesComponent);

View File

@ -131,7 +131,7 @@ export class DistributionInstancesComponent implements OnInit, OnDestroy {
.subscribe(
response => {
this.totalCount = Number.parseInt(
response.headers.get('x-total-count')
response.headers.get('x-total-count'), 10
);
this.instances = response.body as Instance[];
this.pingInstances();

View File

@ -1,4 +1,4 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { TranslateModule } from '@ngx-translate/core';
import { ClarityModule } from '@clr/angular';
import { SharedTestingModule } from '../../../../shared/shared.module';
@ -32,8 +32,8 @@ describe('DistributionSetupModalComponent', () => {
}
};
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [
ClarityModule,
TranslateModule,
@ -44,7 +44,7 @@ describe('DistributionSetupModalComponent', () => {
providers: [ { provide: PreheatService, useValue: fakedPreheatService }],
declarations: [DistributionSetupModalComponent]
}).compileComponents();
}));
});
beforeEach(() => {
fixture = TestBed.createComponent(DistributionSetupModalComponent);

View File

@ -1,9 +1,8 @@
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { ClarityModule } from '@clr/angular';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { TranslateModule, TranslateService } from '@ngx-translate/core';
import { SessionService } from "../../../shared/services/session.service";
import { GcPageComponent } from './gc-page.component';
import { SharedTestingModule } from '../../../shared/shared.module';
describe('GcPageComponent', () => {
let component: GcPageComponent;
@ -13,23 +12,20 @@ describe('GcPageComponent', () => {
return { has_admin_role: true };
}
};
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [GcPageComponent],
schemas: [
CUSTOM_ELEMENTS_SCHEMA
],
imports: [
ClarityModule,
TranslateModule.forRoot()
SharedTestingModule
],
providers: [
TranslateService,
{ provide: SessionService, useValue: fakeSessionService }
]
})
.compileComponents();
}));
}).compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(GcPageComponent);

View File

@ -1,4 +1,4 @@
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { GcComponent } from './gc.component';
import { ErrorHandler } from '../../../../shared/units/error-handler';
import { CronScheduleComponent } from '../../../../shared/components/cron-schedule';
@ -23,7 +23,7 @@ describe('GcComponent', () => {
};
let spySchedule: jasmine.Spy;
let spyGcNow: jasmine.Spy;
beforeEach(waitForAsync(() => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [
SharedTestingModule
@ -32,9 +32,8 @@ describe('GcComponent', () => {
providers: [
{ provide: ErrorHandler, useValue: fakedErrorHandler },
]
})
.compileComponents();
}));
}).compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(GcComponent);

View File

@ -1,4 +1,4 @@
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { MessageHandlerService } from "../../../../shared/services/message-handler.service";
import { SessionService } from "../../../../shared/services/session.service";
@ -29,8 +29,8 @@ describe('AddGroupModalComponent', () => {
};
let fakeMessageHandlerService = null;
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [AddGroupModalComponent],
imports: [
SharedTestingModule
@ -44,9 +44,8 @@ describe('AddGroupModalComponent', () => {
{ provide: AppConfigService, useValue: fakeAppConfigService },
{ provide: UsergroupService, useValue: fakeGroupService },
]
})
.compileComponents();
}));
}).compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(AddGroupModalComponent);

View File

@ -1,4 +1,4 @@
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { GroupComponent } from './group.component';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { SessionService } from "../../../shared/services/session.service";
@ -48,8 +48,8 @@ describe('GroupComponent', () => {
}
};
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [GroupComponent],
imports: [
SharedTestingModule
@ -65,9 +65,8 @@ describe('GroupComponent', () => {
{ provide: SessionService, useValue: fakeSessionService },
{ provide: AppConfigService, useValue: fakeAppConfigService }
]
})
.compileComponents();
}));
}).compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(GroupComponent);

View File

@ -1,29 +1,24 @@
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { InterrogationServicesComponent } from './interrogation-services.component';
import { SharedTestingModule } from "../../../shared/shared.module";
import { BrowserAnimationsModule } from "@angular/platform-browser/animations";
import { ClarityModule } from "@clr/angular";
import { TranslateService } from "@ngx-translate/core";
import { CUSTOM_ELEMENTS_SCHEMA } from "@angular/core";
describe('InterrogationServicesComponent', () => {
let component: InterrogationServicesComponent;
let fixture: ComponentFixture<InterrogationServicesComponent>;
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [
SharedTestingModule,
BrowserAnimationsModule,
ClarityModule,
],
declarations: [ InterrogationServicesComponent ],
providers: [TranslateService],
schemas: [
CUSTOM_ELEMENTS_SCHEMA
],
})
.compileComponents();
}));
}).compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(InterrogationServicesComponent);

View File

@ -1,4 +1,4 @@
import { ComponentFixture, TestBed, waitForAsync, ComponentFixtureAutoDetect } from '@angular/core/testing';
import { ComponentFixture, TestBed, ComponentFixtureAutoDetect } from '@angular/core/testing';
import { VulnerabilityConfigComponent } from "./vulnerability-config.component";
import { ScanAllRepoService } from "./scanAll.service";
import { of } from "rxjs";
@ -60,7 +60,7 @@ const fakedScanAllService = {
};
describe('VulnerabilityConfigComponent', () => {
beforeEach(waitForAsync(() => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [
SharedTestingModule,
@ -77,8 +77,8 @@ describe('VulnerabilityConfigComponent', () => {
// open auto detect
{ provide: ComponentFixtureAutoDetect, useValue: true }
]
});
}));
}).compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(VulnerabilityConfigComponent);

View File

@ -1,4 +1,4 @@
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { LabelsComponent } from './labels.component';
import { CUSTOM_ELEMENTS_SCHEMA } from "@angular/core";
@ -11,7 +11,7 @@ describe('LabelsComponent', () => {
let component: LabelsComponent;
let fixture: ComponentFixture<LabelsComponent>;
beforeEach(waitForAsync(() => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [
SharedTestingModule,
@ -25,7 +25,7 @@ describe('LabelsComponent', () => {
],
})
.compileComponents();
}));
});
beforeEach(() => {
fixture = TestBed.createComponent(LabelsComponent);

View File

@ -1,4 +1,4 @@
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { DebugElement } from '@angular/core';
import { RecentLogComponent } from './recent-log.component';
import { ErrorHandler } from '../../../shared/units/error-handler';
@ -68,8 +68,8 @@ describe('RecentLogComponent (inline template)', () => {
}
}
};
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [
SharedTestingModule
],
@ -78,9 +78,8 @@ describe('RecentLogComponent (inline template)', () => {
{ provide: ErrorHandler, useValue: fakedErrorHandler },
{ provide: AuditlogService, useValue: fakedAuditlogService },
]
});
}));
}).compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(RecentLogComponent);
@ -92,7 +91,7 @@ describe('RecentLogComponent (inline template)', () => {
it('should be created', () => {
expect(component).toBeTruthy();
});
it('should get data from AccessLogService', waitForAsync(() => {
it('should get data from AccessLogService', () => {
expect(auditlogService).toBeTruthy();
fixture.detectChanges();
fixture.whenStable().then(() => { // wait for async getRecentLogs
@ -100,20 +99,19 @@ describe('RecentLogComponent (inline template)', () => {
expect(component.recentLogs).toBeTruthy();
expect(component.recentLogs.length).toEqual(15);
});
}));
});
it('should render data to view', waitForAsync(() => {
it('should render data to view', () => {
fixture.detectChanges();
fixture.whenStable().then(() => {
fixture.detectChanges();
let de: DebugElement = fixture.debugElement.query(del => del.classes['datagrid-cell']);
expect(de).toBeTruthy();
let el: HTMLElement = de.nativeElement;
expect(el).toBeTruthy();
expect(el.textContent.trim()).toEqual('user910');
});
}));
});
it('should support pagination', async () => {
fixture.autoDetectChanges(true);
await fixture.whenStable();
@ -126,7 +124,7 @@ describe('RecentLogComponent (inline template)', () => {
expect(component.recentLogs.length).toEqual(3);
});
it('should support filtering list by keywords', waitForAsync(() => {
it('should support filtering list by keywords', () => {
fixture.detectChanges();
let el: HTMLElement = fixture.nativeElement.querySelector('.search-btn');
expect(el).toBeTruthy("Not found search icon");
@ -145,9 +143,9 @@ describe('RecentLogComponent (inline template)', () => {
expect(component.recentLogs.length).toEqual(1);
});
});
}));
});
it('should support refreshing', waitForAsync(() => {
it('should support refreshing', () => {
fixture.detectChanges();
fixture.whenStable().then(() => {
fixture.detectChanges();
@ -168,10 +166,8 @@ describe('RecentLogComponent (inline template)', () => {
expect(component.recentLogs).toBeTruthy();
expect(component.recentLogs.length).toEqual(15);
});
});
});
}));
});
});

View File

@ -1,4 +1,4 @@
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ProjectQuotasContainerComponent } from './project-quotas-container.component';
import { CUSTOM_ELEMENTS_SCHEMA } from "@angular/core";
import { MessageHandlerService } from "../../../shared/services/message-handler.service";
@ -38,8 +38,8 @@ describe('ProjectQuotasContainerComponent', () => {
}
};
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [
SharedTestingModule
],
@ -52,9 +52,8 @@ describe('ProjectQuotasContainerComponent', () => {
schemas: [
CUSTOM_ELEMENTS_SCHEMA
],
})
.compileComponents();
}));
}).compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(ProjectQuotasContainerComponent);

View File

@ -1,8 +1,6 @@
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { EditProjectQuotasComponent } from './edit-project-quotas.component';
import { EditQuotaQuotaInterface } from '../../../../../shared/services';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { ErrorHandler } from '../../../../../shared/units/error-handler';
import { SharedTestingModule } from "../../../../../shared/shared.module";
describe('EditProjectQuotasComponent', () => {
@ -15,7 +13,7 @@ describe('EditProjectQuotasComponent', () => {
quotaHardLimitValue: {storageLimit: -1, storageUnit: "Byte"},
isSystemDefaultQuota: true
};
beforeEach(waitForAsync(() => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [
SharedTestingModule,
@ -23,9 +21,8 @@ describe('EditProjectQuotasComponent', () => {
declarations: [
EditProjectQuotasComponent
]
})
.compileComponents();
}));
}).compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(EditProjectQuotasComponent);

View File

@ -1,8 +1,8 @@
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ProjectQuotasComponent } from './project-quotas.component';
import { Router } from '@angular/router';
import {
Quota, RequestQueryParams
Quota
} from '../../../../shared/services';
import { ErrorHandler } from '../../../../shared/units/error-handler';
import { Observable, of } from 'rxjs';
@ -12,9 +12,7 @@ import { SharedTestingModule } from "../../../../shared/shared.module";
import { EditProjectQuotasComponent } from "./edit-project-quotas/edit-project-quotas.component";
import { QuotaService } from "../../../../../../ng-swagger-gen/services/quota.service";
import { ProjectService } from "../../../../../../ng-swagger-gen/services/project.service";
import { StrictHttpResponse } from "../../../../../../ng-swagger-gen/strict-http-response";
import { HttpHeaders, HttpResponse } from "@angular/common/http";
import { Registry } from "../../../../../../ng-swagger-gen/models/registry";
describe('ProjectQuotasComponent', () => {
@ -62,8 +60,8 @@ describe('ProjectQuotasComponent', () => {
return of([]);
}
};
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [
SharedTestingModule,
],
@ -77,12 +75,10 @@ describe('ProjectQuotasComponent', () => {
{ provide: APP_BASE_HREF, useValue : '/' },
{ provide: Router, useValue: fakedRouter }
]
})
.compileComponents();
}));
beforeEach(waitForAsync(() => {
}).compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(ProjectQuotasComponent);
component = fixture.componentInstance;
component.quotaHardLimitValue = {
@ -102,7 +98,7 @@ describe('ProjectQuotasComponent', () => {
spyUpdate = spyOn(quotaService, 'updateQuota').and.returnValue(of(null));
spyRoute = spyOn(fixture.debugElement.injector.get(Router), 'navigate').and.returnValue(Promise.resolve(true));
fixture.detectChanges();
}));
});
it('should create', () => {
expect(component).toBeTruthy();

View File

@ -1,4 +1,4 @@
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { CreateProjectComponent } from './create-project.component';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { MessageHandlerService } from '../../../../shared/services/message-handler.service';
@ -27,8 +27,8 @@ describe('CreateProjectComponent', () => {
showSuccess: function() {
}
};
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [
SharedTestingModule
],
@ -41,7 +41,7 @@ describe('CreateProjectComponent', () => {
{provide: MessageHandlerService, useValue: mockMessageHandlerService},
]
}).compileComponents();
}));
});
beforeEach(() => {
fixture = TestBed.createComponent(CreateProjectComponent);

View File

@ -1,4 +1,4 @@
import { waitForAsync, ComponentFixture, TestBed, ComponentFixtureAutoDetect } from '@angular/core/testing';
import { ComponentFixture, TestBed, ComponentFixtureAutoDetect } from '@angular/core/testing';
import { TranslateService } from '@ngx-translate/core';
import { ListProjectComponent } from './list-project.component';
import { CUSTOM_ELEMENTS_SCHEMA, ChangeDetectorRef } from '@angular/core';
@ -59,7 +59,7 @@ describe('ListProjectComponent', () => {
const mockOperationService = {
publishInfo$: () => {}
};
beforeEach(waitForAsync(() => {
beforeEach(() => {
TestBed.configureTestingModule({
schemas: [
CUSTOM_ELEMENTS_SCHEMA
@ -82,9 +82,8 @@ describe('ListProjectComponent', () => {
{ provide: ComponentFixtureAutoDetect, useValue: true }
]
})
.compileComponents();
}));
}).compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(ListProjectComponent);

View File

@ -1,11 +1,5 @@
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { TranslateModule, TranslateService } from '@ngx-translate/core';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { BrowserAnimationsModule, NoopAnimationsModule } from '@angular/platform-browser/animations';
import { ClarityModule } from '@clr/angular';
import { FormsModule } from '@angular/forms';
import { RouterTestingModule } from '@angular/router/testing';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { ConfigurationService } from '../../../services/config.service';
import { SessionService } from "../../../shared/services/session.service";
import { of } from 'rxjs';
@ -14,6 +8,7 @@ import { ProjectService } from '../../../shared/services';
import { MessageHandlerService } from '../../../shared/services/message-handler.service';
import { FilterComponent } from '../../../shared/components/filter/filter.component';
import { ProjectsComponent } from "./projects.component";
import { SharedTestingModule } from '../../../shared/shared.module';
describe('ProjectComponent', () => {
let component: ProjectsComponent;
let fixture: ComponentFixture<ProjectsComponent>;
@ -227,35 +222,27 @@ describe('ProjectComponent', () => {
showSuccess() {
},
};
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
beforeEach(async () => {
await TestBed.configureTestingModule({
schemas: [
CUSTOM_ELEMENTS_SCHEMA
],
imports: [
BrowserAnimationsModule,
ClarityModule,
TranslateModule.forRoot(),
FormsModule,
RouterTestingModule,
NoopAnimationsModule,
HttpClientTestingModule
SharedTestingModule
],
declarations: [
ProjectsComponent,
FilterComponent
],
providers: [
TranslateService,
{ provide: SessionService, useValue: mockSessionService },
{ provide: ConfigurationService, useValue: mockConfigurationService },
{ provide: ProjectService, useValue: mockProjectService },
{ provide: MessageHandlerService, useValue: mockMessageHandlerService },
]
})
.compileComponents();
}));
}).compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(ProjectsComponent);

View File

@ -1,4 +1,4 @@
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { StatisticsPanelComponent } from './statistics-panel.component';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { of } from 'rxjs';
@ -46,7 +46,7 @@ describe('StatisticsPanelComponent', () => {
const mockStatisticHandler = {
refreshChan$: of(null)
};
beforeEach(waitForAsync(() => {
beforeEach(() => {
TestBed.configureTestingModule({
schemas: [
CUSTOM_ELEMENTS_SCHEMA
@ -63,7 +63,7 @@ describe('StatisticsPanelComponent', () => {
{provide: MessageHandlerService, useValue: mockMessageHandlerService}
]
}).compileComponents();
}));
});
beforeEach(() => {
fixture = TestBed.createComponent(StatisticsPanelComponent);

View File

@ -1,6 +1,6 @@
import {
ComponentFixture,
TestBed, waitForAsync,
TestBed,
} from "@angular/core/testing";
import { NoopAnimationsModule } from "@angular/platform-browser/animations";
import { FilterComponent } from "../../../../shared/components/filter/filter.component";
@ -266,8 +266,8 @@ describe("CreateEditEndpointComponent (inline template)", () => {
};
}
};
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [SharedTestingModule, NoopAnimationsModule],
declarations: [
FilterComponent,
@ -280,8 +280,8 @@ describe("CreateEditEndpointComponent (inline template)", () => {
{ provide: HttpClient, useValue: fakedHttp },
{ provide: AppConfigService, useValue: mockAppConfigService }
]
});
}));
}).compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(CreateEditEndpointComponent);
@ -305,26 +305,26 @@ describe("CreateEditEndpointComponent (inline template)", () => {
expect(comp).toBeTruthy();
});
it("should get endpoint be called", waitForAsync(() => {
it("should get endpoint be called", () => {
fixture.detectChanges();
fixture.whenStable().then(() => {
fixture.detectChanges();
expect(spy.calls.any()).toBeTruthy();
});
}));
it("should get adapterInfo", waitForAsync(() => {
});
it("should get adapterInfo", () => {
fixture.detectChanges();
fixture.whenStable().then(() => {
fixture.detectChanges();
expect(comp.adapterInfo).toBeTruthy();
});
}));
});
it("should get endpoint and open modal", waitForAsync(() => {
it("should get endpoint and open modal", () => {
fixture.detectChanges();
fixture.whenStable().then(() => {
fixture.detectChanges();
expect(comp.target.name).toEqual("target_01");
});
}));
});
});

View File

@ -1,4 +1,4 @@
import { ComponentFixture, TestBed, waitForAsync } from "@angular/core/testing";
import { ComponentFixture, TestBed } from "@angular/core/testing";
import { NO_ERRORS_SCHEMA } from "@angular/core";
import { EndpointComponent } from "./endpoint.component";
import { CreateEditEndpointComponent } from "./create-edit-endpoint/create-edit-endpoint.component";
@ -361,7 +361,7 @@ describe("EndpointComponent (inline template)", () => {
return of(res).pipe(delay(0));
}
};
beforeEach(waitForAsync(() => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [SharedTestingModule],
declarations: [
@ -380,7 +380,7 @@ describe("EndpointComponent (inline template)", () => {
NO_ERRORS_SCHEMA
]
}).compileComponents();
}));
});
beforeEach(() => {
fixture = TestBed.createComponent(EndpointComponent);

View File

@ -1,5 +1,4 @@
import {ComponentFixture, fakeAsync, TestBed, tick, waitForAsync} from "@angular/core/testing";
import { NoopAnimationsModule } from "@angular/platform-browser/animations";
import { ComponentFixture, fakeAsync, TestBed, tick } from "@angular/core/testing";
import { ConfirmationDialogComponent } from "../../../../../shared/components/confirmation-dialog";
import { CronTooltipComponent } from "../../../../../shared/components/cron-schedule";
import { CreateEditRuleComponent } from "./create-edit-rule.component";
@ -16,7 +15,6 @@ import {
ReplicationService,
} from "../../../../../shared/services";
import {LabelPieceComponent} from "../../../../../shared/components/label/label-piece/label-piece.component";
import { RouterTestingModule } from '@angular/router/testing';
import { of } from "rxjs";
import {HttpHeaders, HttpResponse} from "@angular/common/http";
import {delay} from "rxjs/operators";
@ -228,9 +226,9 @@ describe("CreateEditRuleComponent (inline template)", () => {
return of(mockEndpoints).pipe(delay(0));
}
};
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [SharedTestingModule, NoopAnimationsModule, RouterTestingModule],
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [ SharedTestingModule ],
declarations: [
CreateEditRuleComponent,
CronTooltipComponent,
@ -245,8 +243,8 @@ describe("CreateEditRuleComponent (inline template)", () => {
{ provide: ReplicationService, useValue: fakedReplicationService },
{ provide: RegistryService, useValue: fakedEndpointService },
]
});
}));
}).compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(CreateEditRuleComponent);

View File

@ -1,5 +1,4 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { NoopAnimationsModule } from "@angular/platform-browser/animations";
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ConfirmationDialogComponent } from '../../../../../shared/components/confirmation-dialog';
import { ListReplicationRuleComponent } from './list-replication-rule.component';
import { ReplicationRule } from '../../../../../shared/services';
@ -74,11 +73,10 @@ describe('ListReplicationRuleComponent (inline template)', () => {
}
};
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [
SharedTestingModule,
NoopAnimationsModule
],
declarations: [
ListReplicationRuleComponent,
@ -89,8 +87,8 @@ describe('ListReplicationRuleComponent (inline template)', () => {
{provide: ReplicationService, useValue: fakedReplicationService},
{provide: OperationService, useValue: fakedOperationService}
]
});
}));
}).compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(ListReplicationRuleComponent);

View File

@ -1,4 +1,4 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA } from '@angular/core';
import { ReplicationExecution } from "../../../../../../../ng-swagger-gen/models/replication-execution";
import { ReplicationTasksComponent } from "./replication-tasks.component";
@ -66,8 +66,8 @@ describe('ReplicationTasksComponent', () => {
}
};
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
beforeEach(async () => {
await TestBed.configureTestingModule({
schemas: [CUSTOM_ELEMENTS_SCHEMA,
NO_ERRORS_SCHEMA],
imports: [
@ -81,8 +81,8 @@ describe('ReplicationTasksComponent', () => {
{provide: ReplicationService, useValue: fakedReplicationService},
{provide: ActivatedRoute, useValue: fakedActivatedRoute}
]
});
}));
}).compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(ReplicationTasksComponent);
comp = fixture.componentInstance;

View File

@ -1,4 +1,4 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { DebugElement, CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA } from '@angular/core';
import { NoopAnimationsModule } from "@angular/platform-browser/animations";
import { ConfirmationDialogComponent } from '../../../../shared/components/confirmation-dialog';
@ -143,7 +143,7 @@ describe('Replication Component (inline template)', () => {
}
};
beforeEach(waitForAsync(() => {
beforeEach(() => {
TestBed.configureTestingModule({
schemas: [ CUSTOM_ELEMENTS_SCHEMA ,
NO_ERRORS_SCHEMA],
@ -164,7 +164,7 @@ describe('Replication Component (inline template)', () => {
{ provide: OperationService }
]
});
}));
});
beforeEach(() => {
fixture = TestBed.createComponent(ReplicationComponent);
comp = fixture.componentInstance;

View File

@ -1,5 +1,4 @@
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { TranslateService } from '@ngx-translate/core';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { TotalReplicationPageComponent } from './total-replication-page.component';
import {Router, ActivatedRoute} from "@angular/router";
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
@ -28,8 +27,8 @@ describe('TotalReplicationPageComponent', () => {
}
};
const mockActivatedRoute = null;
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
beforeEach(async () => {
await TestBed.configureTestingModule({
schemas: [
CUSTOM_ELEMENTS_SCHEMA
],
@ -44,9 +43,8 @@ describe('TotalReplicationPageComponent', () => {
{ provide: ActivatedRoute, useValue: mockActivatedRoute },
]
})
.compileComponents();
}));
}).compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(TotalReplicationPageComponent);

View File

@ -1,5 +1,5 @@
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { NO_ERRORS_SCHEMA } from "@angular/core";
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { NO_ERRORS_SCHEMA } from "@angular/core";
import { SystemRobotAccountsComponent } from './system-robot-accounts.component';
import { RobotService } from "../../../../../ng-swagger-gen/services/robot.service";
import { HttpHeaders, HttpResponse } from "@angular/common/http";
@ -122,8 +122,8 @@ describe('SystemRobotAccountsComponent', () => {
error() {
}
};
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [
TranslateModule.forRoot(),
CommonModule,
@ -144,9 +144,8 @@ describe('SystemRobotAccountsComponent', () => {
schemas: [
NO_ERRORS_SCHEMA
],
})
.compileComponents();
}));
}).compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(SystemRobotAccountsComponent);

View File

@ -1,4 +1,4 @@
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ClarityModule } from '@clr/angular';
import { TranslateModule, TranslateService } from '@ngx-translate/core';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
@ -11,8 +11,8 @@ describe('ChangePasswordComponent', () => {
let fixture: ComponentFixture<ChangePasswordComponent>;
let fakeUserService = null;
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ChangePasswordComponent],
schemas: [
CUSTOM_ELEMENTS_SCHEMA
@ -26,7 +26,7 @@ describe('ChangePasswordComponent', () => {
{ provide: UserService, useValue: fakeUserService }
]
}).compileComponents();
}));
});
beforeEach(() => {
fixture = TestBed.createComponent(ChangePasswordComponent);

View File

@ -1,6 +1,6 @@
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ClarityModule } from '@clr/angular';
import { TranslateModule, TranslateService } from '@ngx-translate/core';
import { TranslateModule } from '@ngx-translate/core';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { UserService } from './user.service';
import { SessionService } from '../../../shared/services/session.service';
@ -17,8 +17,8 @@ describe('NewUserModalComponent', () => {
handleError: function () { }
};
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [NewUserModalComponent],
imports: [
ClarityModule,
@ -34,7 +34,7 @@ describe('NewUserModalComponent', () => {
{ provide: SessionService, useValue: fakeSessionService }
]
}).compileComponents();
}));
});
beforeEach(() => {
fixture = TestBed.createComponent(NewUserModalComponent);

View File

@ -1,15 +1,13 @@
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { ClarityModule } from '@clr/angular';
import { TranslateModule, TranslateService } from '@ngx-translate/core';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { UserService } from './user.service';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { MessageHandlerService } from '../../../shared/services/message-handler.service';
import { AppConfigService } from '../../../services/app-config.service';
import { SessionService } from '../../../shared/services/session.service';
import { UserComponent } from './user.component';
import { OperationService } from "../../../shared/components/operation/operation.service";
import { ConfirmationDialogService } from "../../global-confirmation-dialog/confirmation-dialog.service";
import { SharedTestingModule } from '../../../shared/shared.module';
describe('UserComponent', () => {
let component: UserComponent;
@ -27,19 +25,16 @@ describe('UserComponent', () => {
handleError: function () { }
};
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [UserComponent],
imports: [
ClarityModule,
TranslateModule.forRoot(),
HttpClientTestingModule
SharedTestingModule
],
schemas: [
CUSTOM_ELEMENTS_SCHEMA
],
providers: [
TranslateService,
ConfirmationDialogService,
OperationService,
{ provide: MessageHandlerService, useValue: fakeMessageHandlerService },
@ -48,7 +43,7 @@ describe('UserComponent', () => {
{ provide: AppConfigService, useValue: fakeAppConfigService }
]
}).compileComponents();
}));
});
beforeEach(() => {
fixture = TestBed.createComponent(UserComponent);

View File

@ -1,4 +1,4 @@
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { FormsModule } from '@angular/forms';
import { ForgotPasswordComponent } from './forgot-password.component';
import { ClarityModule } from "@clr/angular";
@ -17,8 +17,8 @@ describe('ForgotPasswordComponent', () => {
sendResetPasswordMail: () => of(null)
};
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ForgotPasswordComponent, InlineAlertComponent],
imports: [
FormsModule,
@ -33,7 +33,7 @@ describe('ForgotPasswordComponent', () => {
{ provide: PasswordSettingService, useValue: fakePasswordSettingService }
]
}).compileComponents();
}));
});
let el;
beforeEach(() => {
fixture = TestBed.createComponent(ForgotPasswordComponent);

View File

@ -1,16 +1,12 @@
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { PasswordSettingService } from './password-setting.service';
import { SessionService } from '../../shared/services/session.service';
import { MessageHandlerService } from '../../shared/services/message-handler.service';
import { PasswordSettingComponent } from './password-setting.component';
import { ClarityModule } from "@clr/angular";
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { TranslateModule, TranslateService } from '@ngx-translate/core';
import { FormsModule } from '@angular/forms';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { of } from 'rxjs';
import { ErrorHandler } from '../../shared/units/error-handler';
import { InlineAlertComponent } from "../../shared/components/inline-alert/inline-alert.component";
import { SharedTestingModule } from '../../shared/shared.module';
describe('PasswordSettingComponent', () => {
let component: PasswordSettingComponent;
@ -25,25 +21,20 @@ describe('PasswordSettingComponent', () => {
showSuccess: () => { }
};
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [
ClarityModule,
TranslateModule.forRoot(),
FormsModule,
BrowserAnimationsModule
SharedTestingModule
],
declarations: [PasswordSettingComponent, InlineAlertComponent],
providers: [
TranslateService,
{ provide: PasswordSettingService, useValue: fakePasswordSettingService },
{ provide: SessionService, useValue: fakeSessionService },
{ provide: MessageHandlerService, useValue: fakeMessageHandlerService },
ErrorHandler
],
schemas: [CUSTOM_ELEMENTS_SCHEMA],
}).compileComponents();
}));
});
beforeEach(() => {
fixture = TestBed.createComponent(PasswordSettingComponent);

View File

@ -1,4 +1,4 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { ActivatedRoute, Router } from "@angular/router";
import { SessionService } from '../../../../shared/services/session.service';
@ -16,7 +16,7 @@ describe('ChartDetailComponent', () => {
}
};
beforeEach(waitForAsync(() => {
beforeEach(() => {
TestBed.configureTestingModule({
declarations: [HelmChartDetailComponent],
schemas: [
@ -49,7 +49,7 @@ describe('ChartDetailComponent', () => {
{ provide: SessionService, useValue: fakeSessionService },
]
}).compileComponents();
}));
});
beforeEach(() => {
fixture = TestBed.createComponent(HelmChartDetailComponent);

View File

@ -1,22 +1,19 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { TranslateModule, TranslateService } from '@ngx-translate/core';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ChartDetailDependencyComponent } from './chart-detail-dependency.component';
import { SharedTestingModule } from '../../../../../shared/shared.module';
describe('ChartDetailDependencyComponent', () => {
let component: ChartDetailDependencyComponent;
let fixture: ComponentFixture<ChartDetailDependencyComponent>;
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [
TranslateModule.forRoot()
SharedTestingModule
],
declarations: [ChartDetailDependencyComponent],
providers: [
TranslateService
]
}).compileComponents();
}));
});
beforeEach(() => {
fixture = TestBed.createComponent(ChartDetailDependencyComponent);

View File

@ -1,4 +1,4 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { TranslateService } from '@ngx-translate/core';
import { ChartDetailSummaryComponent } from './chart-detail-summary.component';
import { CUSTOM_ELEMENTS_SCHEMA, SecurityContext } from '@angular/core';
@ -16,7 +16,7 @@ describe('ChartDetailSummaryComponent', () => {
}
};
beforeEach(waitForAsync(() => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [
SharedTestingModule,
@ -33,7 +33,7 @@ describe('ChartDetailSummaryComponent', () => {
{ provide: HelmChartService, useValue: mockHelmChartService },
]
}).compileComponents();
}));
});
beforeEach(() => {
fixture = TestBed.createComponent(ChartDetailSummaryComponent);

View File

@ -1,4 +1,4 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { TranslateModule, TranslateService } from '@ngx-translate/core';
import { ChartDetailValueComponent } from './chart-detail-value.component';
import { CUSTOM_ELEMENTS_SCHEMA, SecurityContext } from '@angular/core';
@ -11,8 +11,8 @@ describe('ChartDetailValueComponent', () => {
let component: ChartDetailValueComponent;
let fixture: ComponentFixture<ChartDetailValueComponent>;
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
beforeEach(async ()=> {
await TestBed.configureTestingModule({
imports: [
TranslateModule.forRoot(),
ClarityModule,
@ -29,7 +29,7 @@ describe('ChartDetailValueComponent', () => {
{ provide: MarkedOptions, useValue: {} },
]
}).compileComponents();
}));
});
beforeEach(() => {
fixture = TestBed.createComponent(ChartDetailValueComponent);

View File

@ -1,4 +1,4 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { TranslateModule, TranslateService } from '@ngx-translate/core';
import { ChartDetailComponent } from './chart-detail.component';
import { ClarityModule } from '@clr/angular';
@ -100,7 +100,7 @@ describe('ChartDetailComponent', () => {
},
downloadChart: function () { }
};
beforeEach(waitForAsync(() => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [
TranslateModule.forRoot(),
@ -118,7 +118,7 @@ describe('ChartDetailComponent', () => {
{ provide: HelmChartService, useValue: mockHelmChartService },
]
}).compileComponents();
}));
});
beforeEach(() => {
fixture = TestBed.createComponent(ChartDetailComponent);

View File

@ -1,30 +1,23 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { TranslateModule, TranslateService } from '@ngx-translate/core';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { LabelFilterComponent } from './label-filter.component';
import { ClarityModule } from '@clr/angular';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { SharedTestingModule } from '../../../../../shared/shared.module';
describe('LabelFilterComponent', () => {
let component: LabelFilterComponent;
let fixture: ComponentFixture<LabelFilterComponent>;
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
beforeEach(async () => {
await TestBed.configureTestingModule({
schemas: [
CUSTOM_ELEMENTS_SCHEMA
],
imports: [
ClarityModule,
TranslateModule.forRoot(),
FormsModule
SharedTestingModule
],
declarations: [LabelFilterComponent],
providers: [
TranslateService
]
}).compileComponents();
}));
});
beforeEach(() => {
fixture = TestBed.createComponent(LabelFilterComponent);

View File

@ -1,4 +1,4 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { TranslateModule, TranslateService } from '@ngx-translate/core';
import { LabelMarkerComponent } from './label-marker.component';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
@ -33,7 +33,7 @@ describe('LabelMarkerComponent', () => {
let component: LabelMarkerComponent;
let fixture: ComponentFixture<LabelMarkerComponent>;
beforeEach(waitForAsync(() => {
beforeEach(() => {
TestBed.configureTestingModule({
schemas: [
CUSTOM_ELEMENTS_SCHEMA
@ -50,9 +50,8 @@ describe('LabelMarkerComponent', () => {
{ provide: ErrorHandler, useValue: mockErrorHandler },
]
})
.compileComponents();
}));
}).compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(LabelMarkerComponent);

View File

@ -87,7 +87,7 @@ export class LabelMarkerComponent implements OnInit {
() => {
this.markedMap.set(label.id, true);
this.refresh();
this.labelChangeDebouncer.next();
this.labelChangeDebouncer.next(null);
let hnd = setInterval(() => this.cdr.markForCheck(), 100);
setTimeout(() => clearInterval(hnd), 5000);
},
@ -114,7 +114,7 @@ export class LabelMarkerComponent implements OnInit {
() => {
this.markedMap.set(label.id, false);
this.refresh();
this.labelChangeDebouncer.next();
this.labelChangeDebouncer.next(null);
let hnd = setInterval(() => this.cdr.markForCheck(), 100);
setTimeout(() => clearInterval(hnd), 5000);
},

View File

@ -1,4 +1,4 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ChartVersionComponent } from './helm-chart-version.component';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { HelmChartService } from "../../helm-chart.service";
@ -77,8 +77,8 @@ describe('ChartVersionComponent', () => {
).pipe(delay(0));
}
};
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
beforeEach(async () => {
await TestBed.configureTestingModule({
schemas: [
CUSTOM_ELEMENTS_SCHEMA
],
@ -94,9 +94,8 @@ describe('ChartVersionComponent', () => {
{ provide: HelmChartService, useValue: mockHelmChartService },
{ provide: OperationService, useValue: mockOperationService },
]
})
.compileComponents();
}));
}).compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(ChartVersionComponent);

View File

@ -1,4 +1,4 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ClarityModule } from '@clr/angular';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { TranslateModule, TranslateService } from '@ngx-translate/core';
@ -15,7 +15,7 @@ describe('ListChartVersionsComponent', () => {
}
};
beforeEach(waitForAsync(() => {
beforeEach(() => {
TestBed.configureTestingModule({
declarations: [ListChartVersionsComponent],
imports: [
@ -47,7 +47,7 @@ describe('ListChartVersionsComponent', () => {
]
})
.compileComponents();
}));
});
beforeEach(() => {
fixture = TestBed.createComponent(ListChartVersionsComponent);

View File

@ -1,4 +1,4 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { TranslateModule, TranslateService } from '@ngx-translate/core';
import { HelmChartComponent } from './helm-chart.component';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
@ -72,8 +72,8 @@ describe('HelmChartComponent', () => {
return of([]);
},
};
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
beforeEach(async () => {
await TestBed.configureTestingModule({
schemas: [
CUSTOM_ELEMENTS_SCHEMA
],
@ -92,9 +92,8 @@ describe('HelmChartComponent', () => {
{ provide: OperationService, useValue: mockOperationService },
]
})
.compileComponents();
}));
}).compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(HelmChartComponent);

View File

@ -1,4 +1,4 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { SessionService } from '../../../../shared/services/session.service';
@ -14,7 +14,7 @@ describe('ListChartsComponent', () => {
}
};
beforeEach(waitForAsync(() => {
beforeEach(()=> {
TestBed.configureTestingModule({
declarations: [ListChartsComponent],
imports: [
@ -42,7 +42,7 @@ describe('ListChartsComponent', () => {
{ provide: SessionService, useValue: fakeSessionService }
]
}).compileComponents();
}));
});
beforeEach(() => {
fixture = TestBed.createComponent(ListChartsComponent);

View File

@ -1,4 +1,4 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { of } from "rxjs";
import { AppConfigService } from "../../../../services/app-config.service";
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
@ -20,8 +20,8 @@ describe('AddHttpAuthGroupComponent', () => {
return of(null);
}};
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [AddGroupComponent],
schemas: [
CUSTOM_ELEMENTS_SCHEMA
@ -34,9 +34,8 @@ describe('AddHttpAuthGroupComponent', () => {
{ provide: AppConfigService, useValue: fakeAppConfigService },
{ provide: MemberService, useValue: fakeMemberService }
],
})
.compileComponents();
}));
}).compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(AddGroupComponent);

View File

@ -1,4 +1,4 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { AddMemberComponent } from './add-member.component';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { UserService } from '../../../left-side-nav/user/user.service';
@ -29,8 +29,8 @@ describe('AddMemberComponent', () => {
handleError: () => { },
isAppLevel: () => { },
};
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
beforeEach(async () => {
await TestBed.configureTestingModule({
schemas: [
CUSTOM_ELEMENTS_SCHEMA
],
@ -55,10 +55,9 @@ describe('AddMemberComponent', () => {
}
}
}
]
}).compileComponents();
}));
});
beforeEach(() => {
fixture = TestBed.createComponent(AddMemberComponent);

View File

@ -1,4 +1,4 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { MemberComponent } from './member.component';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { ActivatedRoute } from "@angular/router";
@ -102,7 +102,7 @@ describe('MemberComponent', () => {
};
beforeEach(waitForAsync(() => {
beforeEach(() => {
TestBed.configureTestingModule({
schemas: [
CUSTOM_ELEMENTS_SCHEMA
@ -135,7 +135,7 @@ describe('MemberComponent', () => {
]
}).compileComponents();
}));
});
beforeEach(() => {
fixture = TestBed.createComponent(MemberComponent);

View File

@ -1,4 +1,4 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { TranslateModule } from '@ngx-translate/core';
import { CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA } from '@angular/core';
import { BrowserAnimationsModule, NoopAnimationsModule } from '@angular/platform-browser/animations';
@ -76,7 +76,7 @@ describe('AddP2pPolicyComponent', () => {
});
}
};
beforeEach(waitForAsync(() => {
beforeEach(() => {
TestBed.configureTestingModule({
schemas: [
CUSTOM_ELEMENTS_SCHEMA,
@ -101,9 +101,8 @@ describe('AddP2pPolicyComponent', () => {
{ provide: AppConfigService, useValue: mockedAppConfigService },
{ provide: ProjectService, useValue: mockedProjectService },
]
})
.compileComponents();
}));
}).compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(AddP2pPolicyComponent);

View File

@ -1,4 +1,4 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ActivatedRoute } from '@angular/router';
import { MessageHandlerService } from "../../../../shared/services/message-handler.service";
import { of } from 'rxjs';
@ -126,7 +126,7 @@ describe('PolicyComponent', () => {
});
}
};
beforeEach(waitForAsync(() => {
beforeEach(() => {
TestBed.configureTestingModule({
schemas: [
CUSTOM_ELEMENTS_SCHEMA
@ -150,9 +150,8 @@ describe('PolicyComponent', () => {
{ provide: AppConfigService, useValue: mockedAppConfigService },
{ provide: ProjectService, useValue: mockedProjectService },
]
})
.compileComponents();
}));
}).compileComponents();
});
beforeEach(async () => {
fixture = TestBed.createComponent(PolicyComponent);

View File

@ -1,4 +1,4 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { TranslateService } from '@ngx-translate/core';
import { CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA } from '@angular/core';
import { P2pProviderService } from '../p2p-provider.service';
@ -82,7 +82,7 @@ describe('TaskListComponent', () => {
return of(true).pipe(delay(0));
}
};
beforeEach(waitForAsync(() => {
beforeEach(() => {
TestBed.configureTestingModule({
schemas: [
CUSTOM_ELEMENTS_SCHEMA,
@ -101,9 +101,8 @@ describe('TaskListComponent', () => {
{ provide: MessageHandlerService, useValue: mockMessageHandlerService },
{ provide: UserPermissionService, useValue: mockUserPermissionService },
]
})
.compileComponents();
}));
}).compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(TaskListComponent);

View File

@ -1,4 +1,4 @@
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { ActivatedRoute, Router } from "@angular/router";
import { SessionService } from '../../../shared/services/session.service';
@ -16,7 +16,7 @@ describe('ProjectConfigComponent', () => {
};
let fakeRouter = null;
beforeEach(waitForAsync(() => {
beforeEach(() => {
TestBed.configureTestingModule({
declarations: [ProjectConfigComponent],
schemas: [
@ -47,7 +47,7 @@ describe('ProjectConfigComponent', () => {
{ provide: SessionService, useValue: fakeSessionService },
]
}).compileComponents();
}));
});
beforeEach(() => {
fixture = TestBed.createComponent(ProjectConfigComponent);

View File

@ -1,15 +1,16 @@
import { SystemInfoService } from '../../../../shared/services';
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { ErrorHandler } from '../../../../shared/units/error-handler';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ConfirmationDialogComponent } from '../../../../shared/components/confirmation-dialog';
import { ProjectPolicyConfigComponent } from './project-policy-config.component';
import { ProjectService } from '../../../../shared/services';
import {SystemCVEAllowlist, SystemInfo} from '../../../../shared/services';
import { SystemCVEAllowlist, SystemInfo } from '../../../../shared/services';
import { Project } from './project';
import { UserPermissionService } from '../../../../shared/services';
import { of } from 'rxjs';
import { CURRENT_BASE_HREF } from "../../../../shared/units/utils";
import { SharedTestingModule } from "../../../../shared/shared.module";
import { ErrorHandler } from '../../../../shared/units/error-handler';
import { MessageHandlerService } from '../../../../shared/services/message-handler.service';
import { Component, ViewChild } from '@angular/core';
const mockSystemInfo: SystemInfo[] = [
{
@ -100,45 +101,54 @@ const userPermissionService = {
}
};
describe('ProjectPolicyConfigComponent', () => {
let fixture: ComponentFixture<ProjectPolicyConfigComponent>,
component: ProjectPolicyConfigComponent;
function createComponent() {
fixture = TestBed.createComponent(ProjectPolicyConfigComponent);
component = fixture.componentInstance;
component.projectId = 1;
fixture.detectChanges();
}
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
let fixture: ComponentFixture<TestHostComponent>,
component: TestHostComponent;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [SharedTestingModule],
declarations: [
TestHostComponent,
ProjectPolicyConfigComponent,
ConfirmationDialogComponent,
ConfirmationDialogComponent,
],
providers: [
ErrorHandler,
{ provide: ErrorHandler, useClass: MessageHandlerService },
{ provide: ProjectService, useValue: projectService },
{ provide: SystemInfoService, useValue: systemInfoService},
{ provide: UserPermissionService, useValue: userPermissionService},
]
})
.compileComponents()
.then(() => {
createComponent();
});
}));
}).compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(TestHostComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
it('should get systemInfo', () => {
expect(component.systemInfo).toBeTruthy();
it('should get systemInfo', async () => {
fixture.detectChanges();
await fixture.whenStable();
expect(component.projectPolicyConfigComponent.systemInfo).toBeTruthy();
});
it('should get projectPolicy', () => {
expect(component.projectPolicy).toBeTruthy();
expect(component.projectPolicy.ScanImgOnPush).toBeTruthy();
expect(component.projectPolicyConfigComponent.projectPolicy).toBeTruthy();
expect(component.projectPolicyConfigComponent.projectPolicy.ScanImgOnPush).toBeTruthy();
});
it('should get hasChangeConfigRole', () => {
expect(component.hasChangeConfigRole).toBeTruthy();
expect(component.projectPolicyConfigComponent.hasChangeConfigRole).toBeTruthy();
});
});
// mock a TestHostComponent for ProjectPolicyConfigComponent
@Component({
template: `
<hbr-project-policy-config [projectName]="'testing'" [projectId]='1'>
</hbr-project-policy-config>`
})
class TestHostComponent {
@ViewChild(ProjectPolicyConfigComponent)
projectPolicyConfigComponent: ProjectPolicyConfigComponent
}

View File

@ -1,4 +1,4 @@
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { TranslateModule, TranslateService } from '@ngx-translate/core';
import { ProjectDetailComponent } from './project-detail.component';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
@ -61,7 +61,7 @@ describe('ProjectDetailComponent', () => {
}
})
};
beforeEach(waitForAsync(() => {
beforeEach(() => {
TestBed.configureTestingModule({
schemas: [
CUSTOM_ELEMENTS_SCHEMA
@ -88,7 +88,7 @@ describe('ProjectDetailComponent', () => {
}
]
}).compileComponents();
}));
});
beforeEach(() => {
fixture = TestBed.createComponent(ProjectDetailComponent);

View File

@ -16,7 +16,7 @@ import { ActivatedRoute, Router } from '@angular/router';
import { Project } from '../project';
import { SessionService } from '../../../shared/services/session.service';
import { AppConfigService } from "../../../services/app-config.service";
import { forkJoin, Subject, Subscription } from "rxjs";
import { forkJoin, Observable, Subject, Subscription } from "rxjs";
import { UserPermissionService, USERSTATICPERMISSION } from "../../../shared/services";
import { ErrorHandler } from "../../../shared/units/error-handler";
import { debounceTime } from 'rxjs/operators';
@ -196,7 +196,7 @@ export class ProjectDetailComponent implements OnInit, AfterViewInit, OnDestroy
}
}
getPermissionsList(projectId: number): void {
let permissionsList = [];
let permissionsList: Array<Observable<boolean>> = [];
permissionsList.push(this.userPermissionService.getPermission(projectId,
USERSTATICPERMISSION.PROJECT.KEY, USERSTATICPERMISSION.PROJECT.VALUE.READ));
permissionsList.push(this.userPermissionService.getPermission(projectId,
@ -226,7 +226,7 @@ export class ProjectDetailComponent implements OnInit, AfterViewInit, OnDestroy
permissionsList.push(this.userPermissionService.getPermission(projectId,
USERSTATICPERMISSION.QUOTA.KEY, USERSTATICPERMISSION.QUOTA.VALUE.READ));
forkJoin(...permissionsList).subscribe(Rules => {
forkJoin(permissionsList).subscribe(Rules => {
[this.hasProjectReadPermission, this.hasLogListPermission, this.hasConfigurationListPermission, this.hasMemberListPermission
, this.hasLabelListPermission, this.hasRepositoryListPermission, this.hasHelmChartsListPermission, this.hasRobotListPermission
, this.hasLabelCreatePermission, this.hasTagRetentionPermission, this.hasWebhookListPermission,

View File

@ -1,4 +1,4 @@
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { Router, ActivatedRoute } from '@angular/router';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { of } from 'rxjs';
@ -22,8 +22,8 @@ describe('ProjectLabelComponent', () => {
}
};
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ProjectLabelComponent],
schemas: [
CUSTOM_ELEMENTS_SCHEMA
@ -50,7 +50,7 @@ describe('ProjectLabelComponent', () => {
{ provide: SessionService, useValue: fakeSessionService }
]
}).compileComponents();
}));
});
beforeEach(() => {
fixture = TestBed.createComponent(ProjectLabelComponent);

View File

@ -1,4 +1,4 @@
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { AuditLogComponent } from './audit-log.component';
import { MessageHandlerService } from '../../../shared/services/message-handler.service';
import { ActivatedRoute, Router } from '@angular/router';
@ -73,8 +73,8 @@ describe('AuditLogComponent', () => {
}
};
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
beforeEach(async () => {
await TestBed.configureTestingModule({
schemas: [
CUSTOM_ELEMENTS_SCHEMA
],
@ -90,7 +90,7 @@ describe('AuditLogComponent', () => {
]
}).compileComponents();
}));
});
beforeEach(() => {
fixture = TestBed.createComponent(AuditLogComponent);
@ -101,16 +101,16 @@ describe('AuditLogComponent', () => {
it('should create', () => {
expect(component).toBeTruthy();
});
it('should get data from AccessLogService', waitForAsync(() => {
it('should get data from AccessLogService', () => {
fixture.detectChanges();
fixture.whenStable().then(() => { // wait for async getRecentLogs
fixture.detectChanges();
expect(component.auditLogs).toBeTruthy();
expect(component.auditLogs.length).toEqual(15);
});
}));
});
it('should render data to view', waitForAsync(() => {
it('should render data to view', () => {
fixture.detectChanges();
fixture.whenStable().then(() => {
fixture.detectChanges();
@ -121,7 +121,7 @@ describe('AuditLogComponent', () => {
expect(el).toBeTruthy();
expect(el.textContent.trim()).toEqual('user910');
});
}));
});
it('should support pagination', async () => {
fixture.autoDetectChanges(true);
await fixture.whenStable();
@ -134,7 +134,7 @@ describe('AuditLogComponent', () => {
expect(component.auditLogs.length).toEqual(3);
});
it('should support filtering list by keywords', waitForAsync(() => {
it('should support filtering list by keywords', () => {
fixture.detectChanges();
let el: HTMLElement = fixture.nativeElement.querySelector('.search-btn');
expect(el).toBeTruthy("Not found search icon");
@ -153,5 +153,5 @@ describe('AuditLogComponent', () => {
expect(component.auditLogs.length).toEqual(1);
});
});
}));
});
});

View File

@ -1,4 +1,4 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ArtifactAdditionsComponent } from './artifact-additions.component';
import { AdditionLinks } from "../../../../../../../ng-swagger-gen/models/addition-links";
import { CURRENT_BASE_HREF } from "../../../../../shared/units/utils";
@ -16,8 +16,8 @@ describe('ArtifactAdditionsComponent', () => {
let component: ArtifactAdditionsComponent;
let fixture: ComponentFixture<ArtifactAdditionsComponent>;
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [
SharedTestingModule
],
@ -29,7 +29,7 @@ describe('ArtifactAdditionsComponent', () => {
],
})
.compileComponents();
}));
});
beforeEach(() => {
fixture = TestBed.createComponent(ArtifactAdditionsComponent);

View File

@ -1,4 +1,4 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ArtifactVulnerabilitiesComponent } from './artifact-vulnerabilities.component';
import { NO_ERRORS_SCHEMA } from "@angular/core";
import { ClarityModule } from "@clr/angular";
@ -93,7 +93,7 @@ describe('ArtifactVulnerabilitiesComponent', () => {
}).pipe(delay(0));
}
};
beforeEach(waitForAsync(() => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [
BrowserAnimationsModule,
@ -120,7 +120,7 @@ describe('ArtifactVulnerabilitiesComponent', () => {
]
})
.compileComponents();
}));
});
beforeEach(() => {
fixture = TestBed.createComponent(ArtifactVulnerabilitiesComponent);

View File

@ -1,4 +1,4 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { NO_ERRORS_SCHEMA } from "@angular/core";
import { AdditionsService } from "../additions.service";
import { of } from "rxjs";
@ -31,8 +31,8 @@ describe('BuildHistoryComponent', () => {
}
};
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [
SharedTestingModule
],
@ -44,9 +44,8 @@ describe('BuildHistoryComponent', () => {
schemas: [
NO_ERRORS_SCHEMA
]
})
.compileComponents();
}));
}).compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(BuildHistoryComponent);

View File

@ -1,4 +1,4 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { TranslateModule, TranslateService } from '@ngx-translate/core';
import { DependenciesComponent } from "./dependencies.component";
import { AdditionsService } from '../additions.service';
@ -34,7 +34,7 @@ describe('DependenciesComponent', () => {
absolute: false,
href: '/test'
};
beforeEach(waitForAsync(() => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [
TranslateModule.forRoot(),
@ -49,7 +49,7 @@ describe('DependenciesComponent', () => {
{ provide: AdditionsService, useValue: mockAdditionsService },
]
}).compileComponents();
}));
});
beforeEach(() => {
fixture = TestBed.createComponent(DependenciesComponent);

View File

@ -1,4 +1,4 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { NO_ERRORS_SCHEMA } from "@angular/core";
import { AdditionsService } from "../additions.service";
import { of } from "rxjs";
@ -158,8 +158,8 @@ describe('SummaryComponent', () => {
return of(readme);
}
};
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [
SharedTestingModule
],
@ -173,9 +173,8 @@ describe('SummaryComponent', () => {
schemas: [
NO_ERRORS_SCHEMA
]
})
.compileComponents();
}));
}).compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(SummaryComponent);

View File

@ -1,4 +1,4 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { CUSTOM_ELEMENTS_SCHEMA, SecurityContext } from '@angular/core';
import { MarkdownModule, MarkedOptions } from 'ngx-markdown';
import { ValuesComponent } from "./values.component";
@ -26,8 +26,8 @@ describe('ValuesComponent', () => {
absolute: false,
href: '/test'
};
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [
SharedTestingModule,
MarkdownModule.forRoot({ sanitize: SecurityContext.HTML }),
@ -41,7 +41,7 @@ describe('ValuesComponent', () => {
{provide: MarkedOptions, useValue: {}},
]
}).compileComponents();
}));
});
beforeEach(() => {
fixture = TestBed.createComponent(ValuesComponent);

View File

@ -1,5 +1,4 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ArtifactCommonPropertiesComponent } from './artifact-common-properties.component';
import { ClarityModule } from "@clr/angular";
import { BrowserAnimationsModule } from "@angular/platform-browser/animations";
@ -16,8 +15,8 @@ describe('ArtifactCommonPropertiesComponent', () => {
os: "linux"
};
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [
ClarityModule,
BrowserAnimationsModule,
@ -32,9 +31,8 @@ describe('ArtifactCommonPropertiesComponent', () => {
providers: [
TranslateService
]
})
.compileComponents();
}));
}).compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(ArtifactCommonPropertiesComponent);

View File

@ -1,4 +1,4 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ArtifactListPageComponent } from './artifact-list-page.component';
import { of } from 'rxjs';
import { ActivatedRoute } from '@angular/router';
@ -37,8 +37,8 @@ describe('ArtifactListPageComponent', () => {
}
}
};
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [
SharedTestingModule
],
@ -47,9 +47,8 @@ describe('ArtifactListPageComponent', () => {
ArtifactListPageService,
{ provide: ActivatedRoute, useValue: mockActivatedRoute },
]
})
.compileComponents();
}));
}).compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(ArtifactListPageComponent);

View File

@ -1,4 +1,4 @@
import { ComponentFixture, TestBed, waitForAsync, } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { of } from "rxjs";
import { ArtifactInfoComponent } from './artifact-info.component';
import { SharedTestingModule } from 'src/app/shared/shared.module';
@ -12,8 +12,8 @@ describe('ArtifactInfoComponent', () => {
updateRepository: () => of(null),
getRepository: () => of({description: ''})
};
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [
SharedTestingModule,
],
@ -23,8 +23,8 @@ describe('ArtifactInfoComponent', () => {
providers: [
{ provide: RepositoryService, useValue: FakedRepositoryService},
]
});
}));
}).compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(ArtifactInfoComponent);

View File

@ -1,4 +1,4 @@
import { ComponentFixture, TestBed, waitForAsync } from "@angular/core/testing";
import { ComponentFixture, TestBed } from "@angular/core/testing";
import { CUSTOM_ELEMENTS_SCHEMA } from "@angular/core";
import { ArtifactListTabComponent } from "./artifact-list-tab.component";
import { of } from "rxjs";
@ -336,8 +336,8 @@ describe("ArtifactListTabComponent (inline template)", () => {
init() {
}
};
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [
SharedTestingModule,
],
@ -366,7 +366,7 @@ describe("ArtifactListTabComponent (inline template)", () => {
{ provide: NewArtifactService, useValue: mockNewArtifactService },
]
}).compileComponents();
}));
});
beforeEach(() => {
fixture = TestBed.createComponent(ArtifactListTabComponent);

View File

@ -1,4 +1,4 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ArtifactSummaryComponent } from "./artifact-summary.component";
import { of } from "rxjs";
import { NO_ERRORS_SCHEMA } from "@angular/core";
@ -67,7 +67,7 @@ describe('ArtifactSummaryComponent', () => {
const mockRouter = {
navigate: () => { }
};
beforeEach(waitForAsync(() => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [
SharedTestingModule,
@ -85,9 +85,8 @@ describe('ArtifactSummaryComponent', () => {
{ provide: ProjectService, useValue: fakedProjectService },
{ provide: ArtifactService, useValue: fakedArtifactDefaultService },
]
})
.compileComponents();
}));
}).compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(ArtifactSummaryComponent);

View File

@ -1,4 +1,4 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ArtifactTagComponent } from './artifact-tag.component';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { HttpClientTestingModule } from '@angular/common/http/testing';
@ -50,7 +50,7 @@ describe('ArtifactTagComponent', () => {
{ resource: USERSTATICPERMISSION.REPOSITORY_TAG.KEY, action: USERSTATICPERMISSION.REPOSITORY_TAG.VALUE.CREATE },
];
let mockHasDeleteImagePermission: boolean = true;
beforeEach(waitForAsync(() => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [
SharedTestingModule,
@ -69,9 +69,8 @@ describe('ArtifactTagComponent', () => {
{ provide: UserPermissionService, useClass: UserPermissionDefaultService },
{ provide: OperationService },
]
})
.compileComponents();
}));
}).compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(ArtifactTagComponent);

View File

@ -1,4 +1,4 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { HistogramChartComponent } from './histogram-chart.component';
import { TranslateModule } from "@ngx-translate/core";
@ -6,15 +6,14 @@ import { TranslateModule } from "@ngx-translate/core";
describe('HistogramChartComponent', () => {
let component: HistogramChartComponent;
let fixture: ComponentFixture<HistogramChartComponent>;
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [
TranslateModule.forRoot()
],
declarations: [ HistogramChartComponent ],
})
.compileComponents();
}));
}).compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(HistogramChartComponent);

View File

@ -1,4 +1,4 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ResultBarChartComponent } from './result-bar-chart.component';
import { ResultTipComponent } from './result-tip.component';
import { ResultTipHistogramComponent } from "./result-tip-histogram/result-tip-histogram.component";
@ -25,8 +25,8 @@ describe('ResultBarChartComponent (inline template)', () => {
}
};
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [
SharedTestingModule
],
@ -41,7 +41,7 @@ describe('ResultBarChartComponent (inline template)', () => {
]
}).compileComponents();
}));
});
beforeEach(() => {
fixture = TestBed.createComponent(ResultBarChartComponent);

View File

@ -1,4 +1,4 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ResultTipHistogramComponent } from './result-tip-histogram.component';
import { ClarityModule } from "@clr/angular";
import { TranslateModule, TranslateService } from "@ngx-translate/core";
@ -8,8 +8,8 @@ import { HistogramChartComponent } from "../histogram-chart/histogram-chart.comp
describe('ResultTipHistogramComponent', () => {
let component: ResultTipHistogramComponent;
let fixture: ComponentFixture<ResultTipHistogramComponent>;
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [
BrowserAnimationsModule,
ClarityModule,
@ -22,9 +22,8 @@ describe('ResultTipHistogramComponent', () => {
ResultTipHistogramComponent,
HistogramChartComponent
]
})
.compileComponents();
}));
}).compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(ResultTipHistogramComponent);

View File

@ -1,4 +1,4 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ResultTipComponent } from './result-tip.component';
import { UserPermissionDefaultService, UserPermissionService, VulnerabilitySummary } from "../../../../../shared/services";
import { VULNERABILITY_SCAN_STATUS } from "../../../../../shared/units/utils";
@ -22,17 +22,16 @@ describe('ResultTipComponent (inline template)', () => {
}
};
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [
SharedTestingModule
],
declarations: [ResultTipComponent],
providers: [
{ provide: UserPermissionService, useClass: UserPermissionDefaultService }]
});
}));
}).compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(ResultTipComponent);
@ -46,7 +45,7 @@ describe('ResultTipComponent (inline template)', () => {
expect(component).toBeTruthy();
});
it('should reader the bar with different width', waitForAsync(() => {
it('should reader the bar with different width', () => {
fixture.detectChanges();
fixture.whenStable().then(() => {
fixture.detectChanges();
@ -57,6 +56,5 @@ describe('ResultTipComponent (inline template)', () => {
expect(el2).not.toBeNull();
expect(el2.style.width).toEqual("0px");
});
}));
});
});

View File

@ -9,7 +9,7 @@
* conditions of the subcomponent's license, as noted in the LICENSE file.
*/
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { GridViewComponent } from './grid-view.component';
import { SharedTestingModule } from "../../../../shared/shared.module";
@ -17,7 +17,7 @@ import { SharedTestingModule } from "../../../../shared/shared.module";
describe('GridViewComponent', () => {
let component: GridViewComponent;
let fixture: ComponentFixture<GridViewComponent>;
beforeEach(waitForAsync(() => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [
SharedTestingModule,
@ -26,7 +26,7 @@ describe('GridViewComponent', () => {
GridViewComponent,
],
}).compileComponents();
}));
});
beforeEach(() => {
fixture = TestBed.createComponent(GridViewComponent);

View File

@ -1,4 +1,4 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { of } from "rxjs";
import { RepositoryService as NewRepositoryService } from "../../../../../ng-swagger-gen/services/repository.service";
import { RepositoryGridviewComponent } from "./repository-gridview.component";
@ -90,7 +90,7 @@ describe('RepositoryComponentGridview (inline template)', () => {
}
}
};
beforeEach(waitForAsync(() => {
beforeEach(() => {
let store = {};
spyOn(localStorage, 'getItem').and.callFake( key => {
return store[key];
@ -117,8 +117,8 @@ describe('RepositoryComponentGridview (inline template)', () => {
{ provide: SystemInfoService, useValue: fakedSystemInfoService },
{ provide: UserPermissionService, useValue: fakedUserPermissionService },
]
});
}));
}).compileComponents();
});
beforeEach(async () => {
fixtureRepo = TestBed.createComponent(RepositoryGridviewComponent);
@ -138,9 +138,9 @@ describe('RepositoryComponentGridview (inline template)', () => {
jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
});
it('should create', waitForAsync(() => {
it('should create', () => {
expect(compRepo).toBeTruthy();
}));
});
it('should be card view', async () => {
const cardViewButton = fixtureRepo.nativeElement.querySelector('.card-btn');
cardViewButton.click();

View File

@ -1,11 +1,7 @@
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { ClarityModule } from '@clr/angular';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { AddRobotComponent } from './add-robot.component';
import { FormsModule } from '@angular/forms';
import { of } from "rxjs";
import { MessageHandlerService } from "../../../../shared/services/message-handler.service";
import { TranslateModule } from '@ngx-translate/core';
import { BrowserAnimationsModule } from "@angular/platform-browser/animations";
import { delay } from "rxjs/operators";
import { RobotService } from "../../../../../../ng-swagger-gen/services/robot.service";
import { OperationService } from "../../../../shared/components/operation/operation.service";
@ -26,14 +22,10 @@ describe('AddRobotComponent', () => {
error() {
}
};
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
beforeEach( async () => {
await TestBed.configureTestingModule({
declarations: [AddRobotComponent],
imports: [
BrowserAnimationsModule,
ClarityModule,
TranslateModule.forRoot(),
FormsModule,
SharedTestingModule
],
providers: [
@ -45,7 +37,7 @@ describe('AddRobotComponent', () => {
NO_ERRORS_SCHEMA
]
}).compileComponents();
}));
});
beforeEach(() => {
fixture = TestBed.createComponent(AddRobotComponent);

View File

@ -1,4 +1,4 @@
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { NO_ERRORS_SCHEMA } from '@angular/core';
import { of, Subscription } from 'rxjs';
import { ActivatedRoute, RouterModule } from "@angular/router";
@ -106,8 +106,8 @@ describe('RobotAccountComponent', () => {
error() {
}
};
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
beforeEach(async () => {
await TestBed.configureTestingModule({
schemas: [
NO_ERRORS_SCHEMA
],
@ -141,7 +141,7 @@ describe('RobotAccountComponent', () => {
],
declarations: [RobotAccountComponent, HarborDatetimePipe]
}).compileComponents();
}));
});
beforeEach(() => {
fixture = TestBed.createComponent(RobotAccountComponent);

View File

@ -1,4 +1,4 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { of } from "rxjs";
import { TranslateService } from "@ngx-translate/core";
import { MessageHandlerService } from "../../../shared/services/message-handler.service";
@ -59,7 +59,7 @@ describe('ScannerComponent', () => {
}
}
};
beforeEach(waitForAsync(() => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [
SharedTestingModule,
@ -74,7 +74,7 @@ describe('ScannerComponent', () => {
]
})
.compileComponents();
}));
});
beforeEach(() => {
fixture = TestBed.createComponent(ScannerComponent);
component = fixture.componentInstance;

View File

@ -1,4 +1,4 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { of } from 'rxjs';
@ -61,7 +61,7 @@ describe('SummaryComponent', () => {
}
};
beforeEach(waitForAsync(() => {
beforeEach(() => {
TestBed.configureTestingModule({
declarations: [SummaryComponent],
imports: [
@ -101,7 +101,7 @@ describe('SummaryComponent', () => {
},
]
}).compileComponents();
}));
});
beforeEach(() => {
fixture = TestBed.createComponent(SummaryComponent);

View File

@ -1,15 +1,11 @@
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { ClarityModule } from '@clr/angular';
import { FormsModule } from '@angular/forms';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { CUSTOM_ELEMENTS_SCHEMA, EventEmitter } from '@angular/core';
import { TranslateModule } from '@ngx-translate/core';
import { ImmutableTagService } from '../immutable-tag.service';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { NoopAnimationsModule } from "@angular/platform-browser/animations";
import { ImmutableRetentionRule } from "../../tag-retention/retention";
import { ErrorHandler } from '../../../../../shared/units/error-handler';
import { InlineAlertComponent } from "../../../../../shared/components/inline-alert/inline-alert.component";
import { AddImmutableRuleComponent } from "./add-immutable-rule.component";
import { SharedTestingModule } from '../../../../../shared/shared.module';
describe('AddRuleComponent', () => {
let component: AddImmutableRuleComponent;
@ -41,18 +37,14 @@ describe('AddRuleComponent', () => {
const mockErrorHandler = {
handleErrorPopupUnauthorized: () => {}
};
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [AddImmutableRuleComponent, InlineAlertComponent],
schemas: [
CUSTOM_ELEMENTS_SCHEMA
],
imports: [
ClarityModule,
FormsModule,
NoopAnimationsModule,
HttpClientTestingModule,
TranslateModule.forRoot()
SharedTestingModule
],
providers: [
ImmutableTagService,
@ -61,9 +53,8 @@ describe('AddRuleComponent', () => {
provide: ErrorHandler, useValue: mockErrorHandler
}
]
})
.compileComponents();
}));
}).compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(AddImmutableRuleComponent);
@ -83,12 +74,10 @@ describe('AddRuleComponent', () => {
it('should create', () => {
expect(component).toBeTruthy();
});
it("should rightly display default repositories and tag", waitForAsync(() => {
it("should rightly display default repositories and tag", () => {
fixture.detectChanges();
fixture.whenStable().then(() => {
fixture.detectChanges();
let elRep: HTMLInputElement = fixture.nativeElement.querySelector("#scope-input");
expect(elRep).toBeTruthy();
expect(elRep.value.trim()).toEqual("**");
@ -96,8 +85,8 @@ describe('AddRuleComponent', () => {
expect(elTag).toBeTruthy();
expect(elTag.value.trim()).toEqual("**");
});
}));
it("should rightly close", waitForAsync(() => {
});
it("should rightly close", () => {
fixture.detectChanges();
let elRep: HTMLButtonElement = fixture.nativeElement.querySelector("#close-btn");
elRep.dispatchEvent(new Event('click'));
@ -106,8 +95,8 @@ describe('AddRuleComponent', () => {
fixture.detectChanges();
expect(component.addRuleOpened).toEqual(false);
});
}));
it("should be validating repeat rule ", waitForAsync(() => {
});
it("should be validating repeat rule ", () => {
fixture.detectChanges();
component.rules = [mockRule];
const elRep: HTMLButtonElement = fixture.nativeElement.querySelector("#add-edit-btn");
@ -118,5 +107,5 @@ describe('AddRuleComponent', () => {
const elRep1: HTMLSpanElement = fixture.nativeElement.querySelector(".alert-text");
expect(elRep1).toBeTruthy();
});
}));
});
});

View File

@ -1,216 +1,162 @@
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ImmutableTagComponent } from './immutable-tag.component';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { NO_ERRORS_SCHEMA } from '@angular/core';
import { ImmutableTagService } from './immutable-tag.service';
import { ActivatedRoute } from '@angular/router';
import { of, throwError } from 'rxjs';
import { ErrorHandler } from "../../../../shared/units/error-handler";
import { clone } from "../../../../shared/units/utils";
import { InlineAlertComponent } from "../../../../shared/components/inline-alert/inline-alert.component";
import { AddImmutableRuleComponent } from "./add-rule/add-immutable-rule.component";
import { SharedTestingModule } from "../../../../shared/shared.module";
import { RuleMetadate } from "../tag-retention/retention";
import { clone } from '../../../../shared/units/utils';
import { InlineAlertComponent } from '../../../../shared/components/inline-alert/inline-alert.component';
import { SharedTestingModule } from '../../../../shared/shared.module';
import { AddImmutableRuleComponent } from './add-rule/add-immutable-rule.component';
describe('ImmutableTagComponent', () => {
let component: ImmutableTagComponent;
let addRuleComponent: AddImmutableRuleComponent;
let immutableTagService: ImmutableTagService;
let errorHandler: ErrorHandler;
let fixture: ComponentFixture<ImmutableTagComponent>;
let fixtureAddrule: ComponentFixture<AddImmutableRuleComponent>;
let mockMetadata: RuleMetadate = {
"templates": [
{
"rule_template": "latestPushedK",
"display_text": "the most recently pushed # images",
"action": "retain",
"params": [
{
"type": "int",
"unit": "COUNT",
"required": true
}
]
},
{
"rule_template": "latestPulledN",
"display_text": "the most recently pulled # images",
"action": "retain",
"params": [
{
"type": "int",
"unit": "COUNT",
"required": true
}
]
},
{
"rule_template": "nDaysSinceLastPush",
"display_text": "pushed within the last # days",
"action": "retain",
"params": [
{
"type": "int",
"unit": "DAYS",
"required": true
}
]
},
{
"rule_template": "nDaysSinceLastPull",
"display_text": "pulled within the last # days",
"action": "retain",
"params": [
{
"type": "int",
"unit": "DAYS",
"required": true
}
]
},
{
"rule_template": "always",
"display_text": "always",
"action": "retain",
"params": []
}
],
"scope_selectors": [
{
"display_text": "Repositories",
"kind": "doublestar",
"decorations": [
"repoMatches",
"repoExcludes"
]
}
],
"tag_selectors": [
{
"display_text": "Tags",
"kind": "doublestar",
"decorations": [
"matches",
"excludes"
]
}
]
};
let mockRules =
const mockRules =
[
{
"id": 1,
"project_id": 1,
"disabled": false,
"priority": 0,
"action": "immutable",
"template": "immutable_template",
"tag_selectors": [
'id': 1,
'project_id': 1,
'disabled': false,
'priority': 0,
'action': 'immutable',
'template': 'immutable_template',
'tag_selectors': [
{
"kind": "doublestar",
"decoration": "matches",
"pattern": "**"
'kind': 'doublestar',
'decoration': 'matches',
'pattern': '**'
}
],
"scope_selectors": {
"repository": [
'scope_selectors': {
'repository': [
{
"kind": "doublestar",
"decoration": "repoMatches",
"pattern": "**"
}
]
}
}, {
"id": 2,
"project_id": 1,
"disabled": false,
"priority": 0,
"action": "immutable",
"template": "immutable_template",
"tag_selectors": [
{
"kind": "doublestar",
"decoration": "matches",
"pattern": "44"
}
],
"scope_selectors": {
"repository": [
{
"kind": "doublestar",
"decoration": "repoMatches",
"pattern": "**"
'kind': 'doublestar',
'decoration': 'repoMatches',
'pattern': '**'
}
]
}
},
{
"id": 3,
"project_id": 1,
"disabled": false,
"priority": 0,
"action": "immutable",
"template": "immutable_template",
"tag_selectors": [
'id': 2,
'project_id': 1,
'disabled': false,
'priority': 0,
'action': 'immutable',
'template': 'immutable_template',
'tag_selectors': [
{
"kind": "doublestar",
"decoration": "matches",
"pattern": "555"
'kind': 'doublestar',
'decoration': 'matches',
'pattern': '44'
}
],
"scope_selectors": {
"repository": [
'scope_selectors': {
'repository': [
{
"kind": "doublestar",
"decoration": "repoMatches",
"pattern": "**"
'kind': 'doublestar',
'decoration': 'repoMatches',
'pattern': '**'
}
]
}
},
{
"id": 4,
"project_id": 1,
"disabled": false,
"priority": 0,
"action": "immutable",
"template": "immutable_template",
"tag_selectors": [
'id': 3,
'project_id': 1,
'disabled': false,
'priority': 0,
'action': 'immutable',
'template': 'immutable_template',
'tag_selectors': [
{
"kind": "doublestar",
"decoration": "matches",
"pattern": "fff**"
'kind': 'doublestar',
'decoration': 'matches',
'pattern': '555'
}
],
"scope_selectors": {
"repository": [
'scope_selectors': {
'repository': [
{
"kind": "doublestar",
"decoration": "repoMatches",
"pattern": "**ggg"
'kind': 'doublestar',
'decoration': 'repoMatches',
'pattern': '**'
}
]
}
},
{
'id': 4,
'project_id': 1,
'disabled': false,
'priority': 0,
'action': 'immutable',
'template': 'immutable_template',
'tag_selectors': [
{
'kind': 'doublestar',
'decoration': 'matches',
'pattern': 'fff**'
}
],
'scope_selectors': {
'repository': [
{
'kind': 'doublestar',
'decoration': 'repoMatches',
'pattern': '**ggg'
}
]
}
}
];
let cloneRule = clone(mockRules[0]);
cloneRule.tag_selectors[0].pattern = 'rep';
let cloneRuleNoId = clone(mockRules[0]);
cloneRuleNoId.id = null;
let cloneDisableRule = clone(mockRules[0]);
cloneDisableRule.disabled = true;
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ImmutableTagComponent, AddImmutableRuleComponent, InlineAlertComponent],
const fakedImmutableTagService = {
getI18nKey() {
return 'test';
},
getRetentionMetadata() {
return throwError(() => {
return { error: { message: 'error' } };
});
},
getRules(projectId) {
if (projectId) {
return of(mockRules);
}
return throwError(() => {
return 'error';
});
},
updateRule() {
return of(null);
},
deleteRule() {
return of(null);
},
createRule(projectId, cloneRuleNoId) {
if (projectId) {
return of(mockRules);
}
return throwError(() => {
return { error: { message: 'error' } };
});
},
getProjectInfo() {
return of(null);
}
};
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ImmutableTagComponent, InlineAlertComponent, AddImmutableRuleComponent],
schemas: [
CUSTOM_ELEMENTS_SCHEMA
NO_ERRORS_SCHEMA
],
imports: [
SharedTestingModule
],
providers: [
ImmutableTagService,
{ provide: ImmutableTagService, useValue: fakedImmutableTagService },
{
provide: ActivatedRoute, useValue: {
paramMap: of({ get: (key) => 'value' }),
@ -225,60 +171,15 @@ describe('ImmutableTagComponent', () => {
data: 1
}
}
},
}
]
})
.compileComponents();
}));
}).compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(ImmutableTagComponent);
fixtureAddrule = TestBed.createComponent(AddImmutableRuleComponent);
component = fixture.componentInstance;
addRuleComponent = fixtureAddrule.componentInstance;
addRuleComponent.open = () => {
return null;
};
component.projectId = 1;
component.addRuleComponent = TestBed.createComponent(AddImmutableRuleComponent).componentInstance;
component.addRuleComponent = TestBed.createComponent(AddImmutableRuleComponent).componentInstance;
component.addRuleComponent.open = () => {
return null;
};
component.addRuleComponent.inlineAlert = TestBed.createComponent(InlineAlertComponent).componentInstance;
immutableTagService = fixture.debugElement.injector.get(ImmutableTagService);
errorHandler = fixture.debugElement.injector.get(ErrorHandler);
spyOn(immutableTagService, "getRetentionMetadata")
.and.returnValue(of(mockMetadata));
spyOn(immutableTagService, "getRules")
.withArgs(component.projectId)
.and.returnValue(of(mockRules))
.withArgs(0)
.and.returnValue(throwError('error'));
spyOn(immutableTagService, "updateRule")
.withArgs(component.projectId, mockRules[0])
.and.returnValue(of(null))
.withArgs(component.projectId, cloneRule)
.and.returnValue(of(null))
.withArgs(component.projectId, cloneDisableRule)
.and.returnValue(of(null));
spyOn(immutableTagService, "deleteRule")
.withArgs(component.projectId, mockRules[3].id)
.and.returnValue(of(null));
spyOn(immutableTagService, "createRule")
.withArgs(component.projectId, cloneRuleNoId)
.and.returnValue(of(null))
.withArgs(0, cloneRuleNoId)
.and.returnValue(throwError({error: { message: 'error'}}));
spyOn(immutableTagService, "getProjectInfo")
.withArgs(component.projectId)
.and.returnValue(of(null));
spyOn(errorHandler, "error")
.and.returnValue(null);
fixture.detectChanges();
});
@ -286,113 +187,103 @@ describe('ImmutableTagComponent', () => {
expect(component).toBeTruthy();
});
it("should show some rules in page", waitForAsync(() => {
it('should show some rules in page', async () => {
fixture.detectChanges();
fixture.whenStable().then(() => {
fixture.detectChanges();
let elRep: HTMLLIElement[] = fixture.nativeElement.querySelectorAll(".rule");
expect(elRep).toBeTruthy();
expect(elRep.length).toEqual(4);
});
}));
it("should show error in list rule", waitForAsync(() => {
await fixture.whenStable();
let elRep: HTMLLIElement[] = fixture.nativeElement.querySelectorAll('.rule');
expect(elRep).toBeTruthy();
expect(elRep.length).toEqual(4);
});
it('should show error in list rule', async () => {
fixture.detectChanges();
await fixture.whenStable();
component.projectId = 0;
component.getRules();
fixture.whenStable().then(() => {
fixture.detectChanges();
component.projectId = 1;
});
}));
it("should toggle disable and enable", waitForAsync(() => {
});
it('should toggle disable and enable', async () => {
fixture.detectChanges();
let elRep: HTMLButtonElement = fixture.nativeElement.querySelector("#action0");
await fixture.whenStable();
let elRep: HTMLButtonElement = fixture.nativeElement.querySelector('#action0');
elRep.dispatchEvent(new Event('click'));
elRep.click();
let elRepDisable: HTMLButtonElement = fixture.nativeElement.querySelector("#disable-btn0");
fixture.detectChanges();
await fixture.whenStable();
let elRepDisable: HTMLButtonElement = fixture.nativeElement.querySelector('#disable-btn0');
expect(elRepDisable).toBeTruthy();
elRepDisable.dispatchEvent(new Event('click'));
elRepDisable.click();
mockRules[0].disabled = true;
fixture.whenStable().then(() => {
fixture.detectChanges();
let elRepDisableIcon: HTMLButtonElement = fixture.nativeElement.querySelector("#disable-icon0");
expect(elRepDisableIcon).toBeTruthy();
});
}));
it("should be deleted", waitForAsync(() => {
fixture.detectChanges();
let elRep: HTMLButtonElement = fixture.nativeElement.querySelector("#action0");
await fixture.whenStable();
let elRepDisableIcon: HTMLButtonElement = fixture.nativeElement.querySelector('#disable-icon0');
expect(elRepDisableIcon).toBeTruthy();
});
it('should be deleted', async () => {
fixture.detectChanges();
await fixture.whenStable();
let elRep: HTMLButtonElement = fixture.nativeElement.querySelector('#action0');
elRep.dispatchEvent(new Event('click'));
elRep.click();
let elRepDisable: HTMLButtonElement = fixture.nativeElement.querySelector("#delete-btn3");
fixture.detectChanges();
await fixture.whenStable();
let elRepDisable: HTMLButtonElement = fixture.nativeElement.querySelector('#delete-btn3');
expect(elRepDisable).toBeTruthy();
elRepDisable.dispatchEvent(new Event('click'));
elRepDisable.click();
let rule = mockRules.pop();
fixture.whenStable().then(() => {
fixture.detectChanges();
let elRepRule: HTMLLIElement[] = fixture.nativeElement.querySelectorAll(".rule");
expect(elRepRule.length).toEqual(3);
mockRules.push(rule);
});
}));
it("should be add rule", waitForAsync(() => {
fixture.detectChanges();
component.clickAdd(cloneRuleNoId);
mockRules.push(cloneRuleNoId);
fixture.whenStable().then(() => {
fixture.detectChanges();
let elRepRule: HTMLLIElement[] = fixture.nativeElement.querySelectorAll(".rule");
expect(elRepRule.length).toEqual(5);
mockRules.pop();
});
}));
it("should be add rule error", waitForAsync(() => {
await fixture.whenStable();
fixture.detectChanges();
await fixture.whenStable();
let elRepRule: HTMLLIElement[] = fixture.nativeElement.querySelectorAll('.rule');
expect(elRepRule.length).toEqual(4);
});
it('should be add rule', async () => {
fixture.detectChanges();
await fixture.whenStable();
component.clickAdd(clone(mockRules[0]));
fixture.detectChanges();
await fixture.whenStable();
let elRepRule: HTMLLIElement[] = fixture.nativeElement.querySelectorAll('.rule');
expect(elRepRule.length).toEqual(4);
});
it('should be add rule error', async () => {
fixture.detectChanges();
await fixture.whenStable();
component.projectId = 0;
component.clickAdd(cloneRuleNoId);
// mockRules.push(cloneRuleNoId);
fixture.whenStable().then(() => {
fixture.detectChanges();
component.projectId = 1;
let elRepRule: HTMLLIElement[] = fixture.nativeElement.querySelectorAll(".rule");
expect(elRepRule.length).toEqual(4);
// mockRules.pop();
});
}));
it("should be edit rule ", waitForAsync(() => {
const rule = clone(mockRules[0]);
rule.id = null;
component.clickAdd(rule);
fixture.detectChanges();
component.clickAdd(cloneRule);
await fixture.whenStable();
component.projectId = 1;
fixture.detectChanges();
await fixture.whenStable();
let elRepRule: HTMLLIElement[] = fixture.nativeElement.querySelectorAll('.rule');
expect(elRepRule.length).toEqual(4);
});
it('should be edit rule ', async () => {
fixture.detectChanges();
await fixture.whenStable();
component.clickAdd(clone(mockRules[0]));
mockRules[0].tag_selectors[0].pattern = 'rep';
fixture.whenStable().then(() => {
fixture.detectChanges();
let elRepRule: HTMLLIElement = fixture.nativeElement.querySelector("#tag-selectors-patten0");
expect(elRepRule.textContent).toEqual('rep');
mockRules[0].tag_selectors[0].pattern = '**';
});
}));
it("should be edit rule with no add", waitForAsync(() => {
fixture.detectChanges();
await fixture.whenStable();
let elRepRule: HTMLLIElement = fixture.nativeElement.querySelector('#tag-selectors-patten0');
expect(elRepRule.textContent).toEqual('rep');
mockRules[0].tag_selectors[0].pattern = '**';
});
it('should be edit rule with no add', async () => {
fixture.detectChanges();
await fixture.whenStable();
component.addRuleComponent.isAdd = false;
component.clickAdd(cloneRule);
component.clickAdd(clone(mockRules[0]));
mockRules[0].tag_selectors[0].pattern = 'rep';
fixture.whenStable().then(() => {
fixture.detectChanges();
let elRepRule: HTMLLIElement = fixture.nativeElement.querySelector("#tag-selectors-patten0");
expect(elRepRule.textContent).toEqual('rep');
mockRules[0].tag_selectors[0].pattern = '**';
component.addRuleComponent.isAdd = true;
});
}));
fixture.detectChanges();
await fixture.whenStable();
let elRepRule: HTMLLIElement = fixture.nativeElement.querySelector('#tag-selectors-patten0');
expect(elRepRule.textContent).toEqual('rep');
mockRules[0].tag_selectors[0].pattern = '**';
component.addRuleComponent.isAdd = true;
});
});

View File

@ -1,21 +1,18 @@
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { TagFeatureIntegrationComponent } from './tag-feature-integration.component';
import { RouterModule } from '@angular/router';
import { TranslateModule } from '@ngx-translate/core';
import { RouterTestingModule } from '@angular/router/testing';
import { SharedTestingModule } from '../../../shared/shared.module';
describe('TagFeatureIntegrationComponent', () => {
let component: TagFeatureIntegrationComponent;
let fixture: ComponentFixture<TagFeatureIntegrationComponent>;
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ TagFeatureIntegrationComponent ],
imports: [ RouterModule, TranslateModule.forRoot(), RouterTestingModule ]
imports: [ SharedTestingModule ]
})
.compileComponents();
}));
});
beforeEach(() => {
fixture = TestBed.createComponent(TagFeatureIntegrationComponent);

View File

@ -1,4 +1,4 @@
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { TranslateModule, TranslateService } from '@ngx-translate/core';
import { AddRuleComponent } from './add-rule.component';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
@ -15,7 +15,7 @@ describe('AddRuleComponent', () => {
let fixture: ComponentFixture<AddRuleComponent>;
const mockTagRetentionService = { };
beforeEach(waitForAsync(() => {
beforeEach(() => {
TestBed.configureTestingModule({
schemas: [
CUSTOM_ELEMENTS_SCHEMA
@ -35,9 +35,8 @@ describe('AddRuleComponent', () => {
ErrorHandler,
{ provide: TagRetentionService, useValue: mockTagRetentionService },
]
})
.compileComponents();
}));
}).compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(AddRuleComponent);

View File

@ -1,4 +1,4 @@
import { waitForAsync, ComponentFixture, TestBed, fakeAsync, tick } from '@angular/core/testing';
import { ComponentFixture, TestBed, fakeAsync, tick } from '@angular/core/testing';
import { TagRetentionComponent } from './tag-retention.component';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { of } from 'rxjs';
@ -86,8 +86,8 @@ describe('TagRetentionComponent', () => {
}
}
};
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
beforeEach(async () => {
await TestBed.configureTestingModule({
schemas: [
CUSTOM_ELEMENTS_SCHEMA
],
@ -99,9 +99,8 @@ describe('TagRetentionComponent', () => {
{provide: TagRetentionService, useValue: mockTagRetentionService},
{provide: ActivatedRoute, useValue: mockActivatedRoute},
]
})
.compileComponents();
}));
}).compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(TagRetentionComponent);

Some files were not shown because too many files have changed in this diff Show More