Changed to use TestBed.inject method instead of deprecated TestBed.get

This commit is contained in:
Giuseppe Digilio
2020-11-20 15:21:34 +01:00
parent 32dc9a80a6
commit 79285b203b
80 changed files with 2269 additions and 2635 deletions

View File

@@ -56,8 +56,8 @@
}, },
{ {
"type": "anyComponentStyle", "type": "anyComponentStyle",
"maximumWarning": "6kb", "maximumWarning": "200kb",
"maximumError": "10kb" "maximumError": "300kb"
} }
] ]
} }

View File

@@ -22,12 +22,17 @@
"start:prod": "yarn run build:prod && yarn run serve:ssr", "start:prod": "yarn run build:prod && yarn run serve:ssr",
"build": "ng build", "build": "ng build",
"build:prod": "yarn run build:ssr", "build:prod": "yarn run build:ssr",
"build:ssr": "yarn run build:client-and-server-bundles && yarn run compile:server",
"ng-high-memory": "node --max_old_space_size=8192 node_modules/@angular/cli/bin/ng",
"build:client-and-server-bundles": "npm run ng-high-memory -- build --prod && npm run ng-high-memory -- run dspace-angular:server:production --bundleDependencies all",
"test:watch": "npm-run-all --parallel config:test:watch test", "test:watch": "npm-run-all --parallel config:test:watch test",
"test": "node --max_old_space_size=8192 node_modules/@angular/cli/bin/ng test --sourceMap=true --watch=true", "test": "node --max_old_space_size=8192 node_modules/@angular/cli/bin/ng test --sourceMap=true --watch=true",
"test:headless": "node --max_old_space_size=8192 node_modules/@angular/cli/bin/ng test --watch=false --sourceMap=true --browsers=ChromeHeadless --code-coverage", "test:headless": "node --max_old_space_size=8192 node_modules/@angular/cli/bin/ng test --watch=false --sourceMap=true --browsers=ChromeHeadless --code-coverage",
"lint": "ng lint", "lint": "ng lint",
"e2e": "ng e2e", "e2e": "ng e2e",
"e2e:ci": "ng e2e --protractor-config=./e2e/protractor-ci.conf.js", "e2e:ci": "ng e2e --protractor-config=./e2e/protractor-ci.conf.js",
"compile:server": "webpack --config webpack.server.config.js --progress --colors",
"serve:ssr": "node dist/server",
"clean:coverage": "rimraf coverage", "clean:coverage": "rimraf coverage",
"clean:dist": "rimraf dist", "clean:dist": "rimraf dist",
"clean:doc": "rimraf doc", "clean:doc": "rimraf doc",
@@ -39,10 +44,7 @@
"clean": "yarn run clean:prod && yarn run clean:node && yarn run clean:env", "clean": "yarn run clean:prod && yarn run clean:node && yarn run clean:env",
"clean:env": "rimraf src/environments/environment.ts", "clean:env": "rimraf src/environments/environment.ts",
"sync-i18n": "yarn run config:dev && ts-node --project ./tsconfig.ts-node.json scripts/sync-i18n-files.ts", "sync-i18n": "yarn run config:dev && ts-node --project ./tsconfig.ts-node.json scripts/sync-i18n-files.ts",
"compile:server_bak": "webpack --config webpack.server.config.js --progress --colors", "postinstall": "ngcc"
"build:ssr_bak": "yarn run build:client-and-server-bundles && yarn run compile:server",
"serve:ssr_bak": "node dist/server",
"build:client-and-server-bundles_bak": "node --max_old_space_size=8192 node_modules/@angular/cli/bin/ng build --prod && ng run dspace-angular:server:production --bundleDependencies all"
}, },
"browser": { "browser": {
"fs": false, "fs": false,
@@ -61,7 +63,7 @@
"@angular/compiler": "~9.1.12", "@angular/compiler": "~9.1.12",
"@angular/core": "~9.1.12", "@angular/core": "~9.1.12",
"@angular/forms": "~9.1.12", "@angular/forms": "~9.1.12",
"@angular/localize": "^9.0.0", "@angular/localize": "9.1.12",
"@angular/platform-browser": "~9.1.12", "@angular/platform-browser": "~9.1.12",
"@angular/platform-browser-dynamic": "~9.1.12", "@angular/platform-browser-dynamic": "~9.1.12",
"@angular/platform-server": "~9.1.12", "@angular/platform-server": "~9.1.12",
@@ -70,25 +72,24 @@
"@ng-bootstrap/ng-bootstrap": "6.2.0", "@ng-bootstrap/ng-bootstrap": "6.2.0",
"@ng-dynamic-forms/core": "9.1.0", "@ng-dynamic-forms/core": "9.1.0",
"@ng-dynamic-forms/ui-ng-bootstrap": "9.1.0", "@ng-dynamic-forms/ui-ng-bootstrap": "9.1.0",
"@ngrx/effects": "^8.6.0", "@ngrx/effects": "^9.2.0",
"@ngrx/router-store": "^8.6.0", "@ngrx/router-store": "^9.2.0",
"@ngrx/store": "^8.6.0", "@ngrx/store": "^9.2.0",
"@nguniversal/express-engine": "9.1.1", "@nguniversal/express-engine": "9.1.1",
"@nguniversal/module-map-ngfactory-loader": "v8.2.6", "@ngx-translate/core": "12.1.2",
"@ngx-translate/core": "11.0.1",
"@nicky-lenaers/ngx-scroll-to": "^9.0.0", "@nicky-lenaers/ngx-scroll-to": "^9.0.0",
"angular-idle-preload": "3.0.0", "angular-idle-preload": "3.0.0",
"angular2-text-mask": "9.0.0", "angular2-text-mask": "9.0.0",
"angulartics2": "7.5.2", "angulartics2": "9.1.0",
"bootstrap": "4.3.1", "bootstrap": "4.3.1",
"caniuse-lite": "^1.0.30000697", "caniuse-lite": "^1.0.30000697",
"cerialize": "0.1.18", "cerialize": "0.1.18",
"cli-progress": "^3.8.0", "cli-progress": "^3.8.0",
"cookie-parser": "1.4.3", "cookie-parser": "1.4.3",
"core-js": "^3.6.4", "core-js": "^3.7.0",
"debug-loader": "^0.0.1", "debug-loader": "^0.0.1",
"deepmerge": "^4.2.2", "deepmerge": "^4.2.2",
"express": "4.16.2", "express": "4.17.1",
"fast-json-patch": "^2.0.7", "fast-json-patch": "^2.0.7",
"file-saver": "^1.3.8", "file-saver": "^1.3.8",
"filesize": "^6.1.0", "filesize": "^6.1.0",
@@ -98,39 +99,39 @@
"json5": "^2.1.0", "json5": "^2.1.0",
"jsonschema": "1.2.2", "jsonschema": "1.2.2",
"jwt-decode": "^2.2.0", "jwt-decode": "^2.2.0",
"klaro": "^0.6.3", "klaro": "^0.7.8",
"moment": "^2.22.1", "moment": "^2.22.1",
"morgan": "^1.9.1", "morgan": "^1.9.1",
"ng-mocks": "^8.1.0", "ng-mocks": "9.6.4",
"ng2-file-upload": "1.4.0", "ng2-file-upload": "1.4.0",
"ng2-nouislider": "^1.8.2", "ng2-nouislider": "^1.8.2",
"ngx-infinite-scroll": "6.0.1", "ngx-infinite-scroll": "6.0.1",
"ngx-moment": "^3.4.0", "ngx-moment": "^3.4.0",
"ngx-pagination": "3.0.3", "ngx-pagination": "3.0.3",
"ngx-sortablejs": "^3.1.4", "ngx-sortablejs": "9.0.0",
"nouislider": "^11.0.0", "nouislider": "^11.0.0",
"pem": "1.13.2", "pem": "1.13.2",
"postcss-cli": "^6.0.0", "postcss-cli": "^8.3.0",
"reflect-metadata": "^0.1.13", "reflect-metadata": "^0.1.13",
"rxjs": "~6.6.3", "rxjs": "^6.6.3",
"rxjs-spy": "^7.5.1", "rxjs-spy": "^7.5.1",
"sass-resources-loader": "^2.0.0", "sass-resources-loader": "^2.0.0",
"sortablejs": "1.7.0", "sortablejs": "1.7.0",
"tslib": "^1.10.0", "tslib": "^1.10.0",
"webfontloader": "1.6.28", "webfontloader": "1.6.28",
"zone.js": "~0.10.2" "zone.js": "^0.10.3"
}, },
"devDependencies": { "devDependencies": {
"@angular-builders/custom-webpack": "8.4.1", "@angular-builders/custom-webpack": "9.2.0",
"@angular-devkit/build-angular": "~0.901.12", "@angular-devkit/build-angular": "~0.901.12",
"@angular/cli": "~9.1.12", "@angular/cli": "~9.1.12",
"@angular/compiler-cli": "~9.1.12", "@angular/compiler-cli": "~9.1.12",
"@angular/language-service": "~9.1.12", "@angular/language-service": "~9.1.12",
"@fortawesome/fontawesome-free": "^5.5.0", "@fortawesome/fontawesome-free": "^5.5.0",
"@ngrx/store-devtools": "^8.6.0", "@ngrx/store-devtools": "^9.2.0",
"@ngtools/webpack": "^8.3.25", "@ngtools/webpack": "9.1.12",
"@types/deep-freeze": "0.1.1", "@types/deep-freeze": "0.1.1",
"@types/express": "^4.17.0", "@types/express": "4.17.9",
"@types/file-saver": "^1.3.0", "@types/file-saver": "^1.3.0",
"@types/jasmine": "^3.3.9", "@types/jasmine": "^3.3.9",
"@types/jasminewd2": "~2.0.3", "@types/jasminewd2": "~2.0.3",
@@ -160,9 +161,9 @@
"npm-run-all": "^4.1.5", "npm-run-all": "^4.1.5",
"optimize-css-assets-webpack-plugin": "^5.0.1", "optimize-css-assets-webpack-plugin": "^5.0.1",
"postcss-apply": "0.11.0", "postcss-apply": "0.11.0",
"postcss-cssnext": "3.1.0",
"postcss-import": "^12.0.1", "postcss-import": "^12.0.1",
"postcss-loader": "^3.0.0", "postcss-loader": "^3.0.0",
"postcss-preset-env": "6.7.0",
"postcss-responsive-type": "1.0.0", "postcss-responsive-type": "1.0.0",
"protractor": "^7.0.0", "protractor": "^7.0.0",
"protractor-istanbul-plugin": "2.0.0", "protractor-istanbul-plugin": "2.0.0",

View File

@@ -33,7 +33,7 @@ describe('AdminSidebarComponent', () => {
imports: [TranslateModule.forRoot(), NoopAnimationsModule, RouterTestingModule], imports: [TranslateModule.forRoot(), NoopAnimationsModule, RouterTestingModule],
declarations: [AdminSidebarComponent], declarations: [AdminSidebarComponent],
providers: [ providers: [
{ provide: Injector, useValue: {} }, Injector,
{ provide: MenuService, useValue: menuService }, { provide: MenuService, useValue: menuService },
{ provide: CSSVariableService, useClass: CSSVariableServiceStub }, { provide: CSSVariableService, useClass: CSSVariableServiceStub },
{ provide: AuthService, useClass: AuthServiceStub }, { provide: AuthService, useClass: AuthServiceStub },

View File

@@ -84,7 +84,7 @@ describe('BreadcrumbsComponent', () => {
beforeEach(() => { beforeEach(() => {
fixture = TestBed.createComponent(BreadcrumbsComponent); fixture = TestBed.createComponent(BreadcrumbsComponent);
component = fixture.componentInstance; component = fixture.componentInstance;
router = TestBed.get(Router); router = TestBed.inject(Router);
fixture.detectChanges(); fixture.detectChanges();
}); });

View File

@@ -195,7 +195,7 @@ describe('CommunityListService', () => {
{ provide: Store, useValue: StoreMock }, { provide: Store, useValue: StoreMock },
], ],
}); });
store = TestBed.get(Store); store = TestBed.inject(Store as any);
service = new CommunityListService(communityDataServiceStub, collectionDataServiceStub, store); service = new CommunityListService(communityDataServiceStub, collectionDataServiceStub, store);
}); });

View File

@@ -31,7 +31,7 @@ describe('AuthResponseParsingService', () => {
})); }));
beforeEach(() => { beforeEach(() => {
store = TestBed.get(Store); store = TestBed.inject(Store);
linkServiceStub = jasmine.createSpyObj({ linkServiceStub = jasmine.createSpyObj({
removeResolvedLinks: {} removeResolvedLinks: {}
}); });

View File

@@ -74,8 +74,8 @@ describe('AuthEffects', () => {
], ],
}); });
authEffects = TestBed.get(AuthEffects); authEffects = TestBed.inject(AuthEffects);
store = TestBed.get(Store); store = TestBed.inject(Store as any);
}); });
describe('authenticate$', () => { describe('authenticate$', () => {

View File

@@ -42,8 +42,8 @@ describe(`AuthInterceptor`, () => {
], ],
}); });
service = TestBed.get(DSpaceRESTv2Service); service = TestBed.inject(DSpaceRESTv2Service);
httpMock = TestBed.get(HttpTestingController); httpMock = TestBed.inject(HttpTestingController);
}); });
describe('when has a valid token', () => { describe('when has a valid token', () => {

View File

@@ -112,7 +112,7 @@ describe('AuthService test', () => {
AuthService AuthService
], ],
}); });
authService = TestBed.get(AuthService); authService = TestBed.inject(AuthService);
}); });
it('should return the authentication status object when user credentials are correct', () => { it('should return the authentication status object when user credentials are correct', () => {
@@ -295,8 +295,8 @@ describe('AuthService test', () => {
}); });
authService = new AuthService({}, window, undefined, authReqService, mockEpersonDataService, router, routeService, cookieService, store, hardRedirectService); authService = new AuthService({}, window, undefined, authReqService, mockEpersonDataService, router, routeService, cookieService, store, hardRedirectService);
storage = (authService as any).storage; storage = (authService as any).storage;
routeServiceMock = TestBed.get(RouteService); routeServiceMock = TestBed.inject(RouteService);
routerStub = TestBed.get(Router); routerStub = TestBed.inject(Router);
spyOn(storage, 'get'); spyOn(storage, 'get');
spyOn(storage, 'remove'); spyOn(storage, 'remove');
spyOn(storage, 'set'); spyOn(storage, 'set');

View File

@@ -99,7 +99,7 @@ describe('DSOBreadcrumbsService', () => {
})); }));
beforeEach(() => { beforeEach(() => {
linkService = TestBed.get(LinkService); linkService = TestBed.inject(LinkService);
linkService.resolveLink.and.callFake((object, link) => object); linkService.resolveLink.and.callFake((object, link) => object);
service = new DSOBreadcrumbsService(linkService, dsoNameService); service = new DSOBreadcrumbsService(linkService, dsoNameService);
}); });

View File

@@ -78,7 +78,7 @@ describe('LinkService', () => {
useValue: testDataService useValue: testDataService
}] }]
}); });
service = TestBed.get(LinkService); service = TestBed.inject(LinkService);
}); });
describe('resolveLink', () => { describe('resolveLink', () => {

View File

@@ -19,7 +19,7 @@ describe('ObjectCacheEffects', () => {
], ],
}); });
cacheEffects = TestBed.get(ObjectCacheEffects); cacheEffects = TestBed.inject(ObjectCacheEffects);
}); });
describe('fixTimestampsOnRehydrate$', () => { describe('fixTimestampsOnRehydrate$', () => {

View File

@@ -66,8 +66,8 @@ describe('ServerSyncBufferEffects', () => {
], ],
}); });
store = TestBed.get(Store); store = TestBed.inject(Store);
ssbEffects = TestBed.get(ServerSyncBufferEffects); ssbEffects = TestBed.inject(ServerSyncBufferEffects);
}); });
describe('setTimeoutForServerSync', () => { describe('setTimeoutForServerSync', () => {

View File

@@ -44,7 +44,7 @@ describe('ObjectUpdatesEffects', () => {
beforeEach(() => { beforeEach(() => {
testURL = 'www.dspace.org/dspace7'; testURL = 'www.dspace.org/dspace7';
testUUID = '20e24c2f-a00a-467c-bdee-c929e79bf08d'; testUUID = '20e24c2f-a00a-467c-bdee-c929e79bf08d';
updatesEffects = TestBed.get(ObjectUpdatesEffects); updatesEffects = TestBed.inject(ObjectUpdatesEffects);
(updatesEffects as any).actionMap$[testURL] = new Subject<ObjectUpdatesAction>(); (updatesEffects as any).actionMap$[testURL] = new Subject<ObjectUpdatesAction>();
(updatesEffects as any).notificationActionMap$[fakeID] = new Subject<ObjectUpdatesAction>(); (updatesEffects as any).notificationActionMap$[fakeID] = new Subject<ObjectUpdatesAction>();
(updatesEffects as any).notificationActionMap$[(updatesEffects as any).allIdentifier] = new Subject<ObjectUpdatesAction>(); (updatesEffects as any).notificationActionMap$[(updatesEffects as any).allIdentifier] = new Subject<ObjectUpdatesAction>();

View File

@@ -22,8 +22,8 @@ describe('DSpaceRESTv2Service', () => {
providers: [DSpaceRESTv2Service] providers: [DSpaceRESTv2Service]
}); });
dSpaceRESTv2Service = TestBed.get(DSpaceRESTv2Service); dSpaceRESTv2Service = TestBed.inject(DSpaceRESTv2Service);
httpMock = TestBed.get(HttpTestingController); httpMock = TestBed.inject(HttpTestingController);
}); });
afterEach(() => httpMock.verify()); afterEach(() => httpMock.verify());

View File

@@ -29,8 +29,8 @@ describe('ForwardClientIpInterceptor', () => {
], ],
}); });
service = TestBed.get(DSpaceRESTv2Service); service = TestBed.inject(DSpaceRESTv2Service);
httpMock = TestBed.get(HttpTestingController); httpMock = TestBed.inject(HttpTestingController);
}); });
it('should add an X-Forwarded-For header matching the client\'s IP', () => { it('should add an X-Forwarded-For header matching the client\'s IP', () => {

View File

@@ -32,7 +32,7 @@ describe('JsonPatchOperationsEffects test suite', () => {
], ],
}); });
jsonPatchOperationsEffects = TestBed.get(JsonPatchOperationsEffects); jsonPatchOperationsEffects = TestBed.inject(JsonPatchOperationsEffects);
}); });
describe('commit$', () => { describe('commit$', () => {

View File

@@ -34,9 +34,9 @@ describe(`LocaleInterceptor`, () => {
], ],
}); });
service = TestBed.get(DSpaceRESTv2Service); service = TestBed.inject(DSpaceRESTv2Service);
httpMock = TestBed.get(HttpTestingController); httpMock = TestBed.inject(HttpTestingController);
localeService = TestBed.get(LocaleService); localeService = TestBed.inject(LocaleService);
localeService.getCurrentLanguageCode.and.returnValue('en') localeService.getCurrentLanguageCode.and.returnValue('en')
}); });

View File

@@ -40,9 +40,9 @@ describe('LocaleService test suite', () => {
})); }));
beforeEach(() => { beforeEach(() => {
cookieService = TestBed.get(CookieService); cookieService = TestBed.inject(CookieService);
translateService = TestBed.get(TranslateService); translateService = TestBed.inject(TranslateService);
authService = TestBed.get(TranslateService); authService = TestBed.inject(AuthService);
window = new NativeWindowRef(); window = new NativeWindowRef();
service = new LocaleService(window, cookieService, translateService, authService); service = new LocaleService(window, cookieService, translateService, authService);
serviceAsAny = service; serviceAsAny = service;

View File

@@ -179,14 +179,14 @@ describe('MetadataService', () => {
], ],
schemas: [CUSTOM_ELEMENTS_SCHEMA] schemas: [CUSTOM_ELEMENTS_SCHEMA]
}); });
meta = TestBed.get(Meta); meta = TestBed.inject(Meta);
title = TestBed.get(Title); title = TestBed.inject(Title);
itemDataService = TestBed.get(ItemDataService); itemDataService = TestBed.inject(ItemDataService);
metadataService = TestBed.get(MetadataService); metadataService = TestBed.inject(MetadataService);
authService = TestBed.get(AuthService); authService = TestBed.inject(AuthService);
router = TestBed.get(Router); router = TestBed.inject(Router);
location = TestBed.get(Location); location = TestBed.inject(Location);
fixture = TestBed.createComponent(TestComponent); fixture = TestBed.createComponent(TestComponent);

View File

@@ -156,8 +156,8 @@ describe('RegistryService', () => {
RegistryService RegistryService
] ]
}); });
registryService = TestBed.get(RegistryService); registryService = TestBed.inject(RegistryService);
mockStore = TestBed.get(Store); mockStore = TestBed.inject(Store);
}); });
describe('when requesting metadataschemas', () => { describe('when requesting metadataschemas', () => {

View File

@@ -15,7 +15,7 @@ describe(CookieService.name, () => {
})); }));
beforeEach(() => { beforeEach(() => {
service = TestBed.get(CookieService) service = TestBed.inject(CookieService)
}); });
afterEach(() => { afterEach(() => {

View File

@@ -10,7 +10,7 @@ describe('HardRedirectService', () => {
beforeEach(() => { beforeEach(() => {
TestBed.configureTestingModule({ providers: [TestHardRedirectService] }); TestBed.configureTestingModule({ providers: [TestHardRedirectService] });
service = TestBed.get(TestHardRedirectService); service = TestBed.inject(TestHardRedirectService);
}); });
describe('when calling rewriteDownloadURL', () => { describe('when calling rewriteDownloadURL', () => {

View File

@@ -53,7 +53,7 @@ describe('RouteService', () => {
})); }));
beforeEach(() => { beforeEach(() => {
service = new RouteService(TestBed.get(ActivatedRoute), TestBed.get(Router), TestBed.get(Store)); service = new RouteService(TestBed.inject(ActivatedRoute), TestBed.inject(Router), TestBed.inject(Store));
serviceAsAny = service; serviceAsAny = service;
}); });

View File

@@ -58,7 +58,7 @@ describe('SearchService', () => {
SearchService SearchService
], ],
}); });
searchService = TestBed.get(SearchService); searchService = TestBed.inject(SearchService);
}); });
it('should return list view mode', () => { it('should return list view mode', () => {
@@ -115,8 +115,8 @@ describe('SearchService', () => {
SearchService SearchService
], ],
}); });
searchService = TestBed.get(SearchService); searchService = TestBed.inject(SearchService);
routeService = TestBed.get(RouteService); routeService = TestBed.inject(RouteService);
const urlTree = Object.assign(new UrlTree(), { root: { children: { primary: 'search' } } }); const urlTree = Object.assign(new UrlTree(), { root: { children: { primary: 'search' } } });
router.parseUrl.and.returnValue(urlTree); router.parseUrl.and.returnValue(urlTree);
}); });

View File

@@ -30,7 +30,7 @@ describe('NavbarComponent', () => {
RouterTestingModule], RouterTestingModule],
declarations: [NavbarComponent], declarations: [NavbarComponent],
providers: [ providers: [
{ provide: Injector, useValue: {} }, Injector,
{ provide: MenuService, useValue: menuService }, { provide: MenuService, useValue: menuService },
{ provide: HostWindowService, useValue: new HostWindowServiceStub(800) }, { provide: HostWindowService, useValue: new HostWindowServiceStub(800) },
{ provide: ActivatedRoute, useValue: {} } { provide: ActivatedRoute, useValue: {} }

View File

@@ -25,7 +25,7 @@ describe('NavbarEffects', () => {
], ],
}); });
navbarEffects = TestBed.get(NavbarEffects); navbarEffects = TestBed.inject(NavbarEffects);
}); });
describe('resize$', () => { describe('resize$', () => {

View File

@@ -67,7 +67,7 @@ describe('BrowserKlaroService', () => {
} }
] ]
}); });
service = TestBed.get(BrowserKlaroService); service = TestBed.inject(BrowserKlaroService);
appName = 'testName'; appName = 'testName';
purpose = 'test purpose'; purpose = 'test purpose';
testKey = 'this.is.a.fake.message.key'; testKey = 'this.is.a.fake.message.key';

View File

@@ -69,7 +69,7 @@ export class BrowserKlaroService extends KlaroService {
const translationServiceReady$ = this.translateService.get('loading.default').pipe(take(1)); const translationServiceReady$ = this.translateService.get('loading.default').pipe(take(1));
observableCombineLatest(user$, translationServiceReady$) observableCombineLatest([user$, translationServiceReady$])
.subscribe(([user, translation]: [EPerson, string]) => { .subscribe(([user, translation]: [EPerson, string]) => {
user = cloneDeep(user); user = cloneDeep(user);

View File

@@ -112,7 +112,7 @@ describe('ExportMetadataSelectorComponent', () => {
fixture = TestBed.createComponent(ExportMetadataSelectorComponent); fixture = TestBed.createComponent(ExportMetadataSelectorComponent);
component = fixture.componentInstance; component = fixture.componentInstance;
debugElement = fixture.debugElement; debugElement = fixture.debugElement;
const modalService = TestBed.get(NgbModal); const modalService = TestBed.inject(NgbModal);
modalRef = modalService.open(ConfirmationModalComponent); modalRef = modalService.open(ConfirmationModalComponent);
modalRef.componentInstance.response = observableOf(true); modalRef.componentInstance.response = observableOf(true);
fixture.detectChanges(); fixture.detectChanges();

View File

@@ -194,7 +194,7 @@ describe('DsDynamicFormControlContainerComponent test suite', () => {
fixture = TestBed.createComponent(DsDynamicFormControlContainerComponent); fixture = TestBed.createComponent(DsDynamicFormControlContainerComponent);
const ngZone = TestBed.get(NgZone); const ngZone = TestBed.inject(NgZone);
// tslint:disable-next-line:ban-types // tslint:disable-next-line:ban-types
spyOn(ngZone, 'runOutsideAngular').and.callFake((fn: Function) => fn()); spyOn(ngZone, 'runOutsideAngular').and.callFake((fn: Function) => fn());
@@ -283,7 +283,7 @@ describe('DsDynamicFormControlContainerComponent test suite', () => {
spyOn(component, 'onModelValueUpdates'); spyOn(component, 'onModelValueUpdates');
(testModel as DynamicInputModel).valueUpdates.next('test'); (testModel as DynamicInputModel).value = 'test';
expect(component.onModelValueUpdates).toHaveBeenCalled(); expect(component.onModelValueUpdates).toHaveBeenCalled();
}); });
@@ -292,7 +292,7 @@ describe('DsDynamicFormControlContainerComponent test suite', () => {
spyOn(component, 'onModelDisabledUpdates'); spyOn(component, 'onModelDisabledUpdates');
testModel.disabledUpdates.next(true); testModel.disabled = true;
expect(component.onModelDisabledUpdates).toHaveBeenCalled(); expect(component.onModelDisabledUpdates).toHaveBeenCalled();
}); });

View File

@@ -66,7 +66,7 @@ export class DsDynamicLookupComponent extends DsDynamicVocabularyComponent imple
this.setCurrentValue(this.model.value, true); this.setCurrentValue(this.model.value, true);
} }
this.subs.push(this.model.valueUpdates this.subs.push(this.model.valueChanges
.subscribe((value) => { .subscribe((value) => {
if (isEmpty(value)) { if (isEmpty(value)) {
this.resetFields(); this.resetFields();

View File

@@ -378,7 +378,7 @@ describe('DsDynamicOneboxComponent test suite', () => {
spyOn(vocabularyServiceStub, 'findVocabularyById').and.returnValue(createSuccessfulRemoteDataObject$(hierarchicalVocabulary)); spyOn(vocabularyServiceStub, 'findVocabularyById').and.returnValue(createSuccessfulRemoteDataObject$(hierarchicalVocabulary));
oneboxCompFixture = TestBed.createComponent(DsDynamicOneboxComponent); oneboxCompFixture = TestBed.createComponent(DsDynamicOneboxComponent);
oneboxComponent = oneboxCompFixture.componentInstance; // FormComponent test instance oneboxComponent = oneboxCompFixture.componentInstance; // FormComponent test instance
modalService = TestBed.get(NgbModal); modalService = TestBed.inject(NgbModal);
modalService.open.and.returnValue(new MockNgbModalRef()); modalService.open.and.returnValue(new MockNgbModalRef());
}); });

View File

@@ -222,7 +222,7 @@ export class DsDynamicRelationGroupComponent extends DynamicFormControlComponent
if (this.model.isEmpty()) { if (this.model.isEmpty()) {
this.initChips([]); this.initChips([]);
} else { } else {
initChipsValue$ = observableOf(this.model.value); initChipsValue$ = observableOf(this.model.value as any[]);
// If authority // If authority
this.subs.push(initChipsValue$.pipe( this.subs.push(initChipsValue$.pipe(
@@ -274,7 +274,7 @@ export class DsDynamicRelationGroupComponent extends DynamicFormControlComponent
} }
return acc; return acc;
}, []), }, []),
filter((modelValues: any[]) => this.model.value.length === modelValues.length) filter((modelValues: any[]) => (this.model.value as any[]).length === modelValues.length)
).subscribe((modelValue) => { ).subscribe((modelValue) => {
this.model.value = modelValue; this.model.value = modelValue;
this.initChips(modelValue); this.initChips(modelValue);

View File

@@ -41,13 +41,9 @@ export class DynamicRelationGroupModel extends DsDynamicInputModel {
this.value = value; this.value = value;
} }
get value() { /* get value() {
return this.value return (isEmpty(this.value)) ? null : this.value
} }*/
set value(value) {
this.value = (isEmpty(value)) ? null : value;
}
isEmpty() { isEmpty() {
const value = this.getGroupValue(); const value = this.getGroupValue();
@@ -67,6 +63,6 @@ export class DynamicRelationGroupModel extends DsDynamicInputModel {
}); });
return [emptyItem]; return [emptyItem];
} }
return this.value return this.value as any[]
} }
} }

View File

@@ -116,7 +116,7 @@ describe('RelationshipEffects', () => {
})); }));
beforeEach(() => { beforeEach(() => {
relationEffects = TestBed.get(RelationshipEffects); relationEffects = TestBed.inject(RelationshipEffects);
identifier = (relationEffects as any).createIdentifier(leftItem, rightItem, relationshipType.leftwardType); identifier = (relationEffects as any).createIdentifier(leftItem, rightItem, relationshipType.leftwardType);
}); });

View File

@@ -446,14 +446,14 @@ describe('FormBuilderService test suite', () => {
expect(service.getValueFromModel(formModel)).toEqual(value); expect(service.getValueFromModel(formModel)).toEqual(value);
((formModel[0] as DynamicRowGroupModel).get(1) as DsDynamicInputModel).valueUpdates.next('test'); ((formModel[0] as DynamicRowGroupModel).get(1) as DsDynamicInputModel).value = 'test';
value = { value = {
issue: [new FormFieldMetadataValueObject('test')] issue: [new FormFieldMetadataValueObject('test')]
}; };
expect(service.getValueFromModel(formModel)).toEqual(value); expect(service.getValueFromModel(formModel)).toEqual(value);
((formModel[2] as DynamicRowGroupModel).get(0) as DynamicOneboxModel).valueUpdates.next('test one'); ((formModel[2] as DynamicRowGroupModel).get(0) as DynamicOneboxModel).value = 'test one';
value = { value = {
issue: [new FormFieldMetadataValueObject('test')], issue: [new FormFieldMetadataValueObject('test')],
conference: [new FormFieldMetadataValueObject('test one')] conference: [new FormFieldMetadataValueObject('test one')]
@@ -465,8 +465,8 @@ describe('FormBuilderService test suite', () => {
const formModel = service.modelFromConfiguration(submissionId, testFormConfiguration, 'testScopeUUID'); const formModel = service.modelFromConfiguration(submissionId, testFormConfiguration, 'testScopeUUID');
const value = {} as any; const value = {} as any;
((formModel[0] as DynamicRowGroupModel).get(1) as DsDynamicInputModel).valueUpdates.next('test'); ((formModel[0] as DynamicRowGroupModel).get(1) as DsDynamicInputModel).value = 'test';
((formModel[2] as DynamicRowGroupModel).get(0) as DynamicOneboxModel).valueUpdates.next('test one'); ((formModel[2] as DynamicRowGroupModel).get(0) as DynamicOneboxModel).value = 'test one';
service.clearAllModelsValue(formModel); service.clearAllModelsValue(formModel);
expect(((formModel[0] as DynamicRowGroupModel).get(1) as DynamicOneboxModel).value).toEqual(undefined) expect(((formModel[0] as DynamicRowGroupModel).get(1) as DynamicOneboxModel).value).toEqual(undefined)
@@ -774,8 +774,8 @@ describe('FormBuilderService test suite', () => {
(formArray.at(index) as FormGroup).controls.testFormArrayGroupInput.setValue('next test value 1'); (formArray.at(index) as FormGroup).controls.testFormArrayGroupInput.setValue('next test value 1');
(formArray.at(index + step) as FormGroup).controls.testFormArrayGroupInput.setValue('next test value 2'); (formArray.at(index + step) as FormGroup).controls.testFormArrayGroupInput.setValue('next test value 2');
(model.get(index).get(0) as DynamicFormValueControlModel<any>).valueUpdates.next('next test value 1'); (model.get(index).get(0) as DynamicFormValueControlModel<any>).value = 'next test value 1';
(model.get(index + step).get(0) as DynamicFormValueControlModel<any>).valueUpdates.next('next test value 2'); (model.get(index + step).get(0) as DynamicFormValueControlModel<any>).value = 'next test value 2';
service.moveFormArrayGroup(index, step, formArray, model); service.moveFormArrayGroup(index, step, formArray, model);
@@ -798,8 +798,8 @@ describe('FormBuilderService test suite', () => {
(formArray.at(index) as FormGroup).controls.testFormArrayGroupInput.setValue('next test value 1'); (formArray.at(index) as FormGroup).controls.testFormArrayGroupInput.setValue('next test value 1');
(formArray.at(index + step) as FormGroup).controls.testFormArrayGroupInput.setValue('next test value 2'); (formArray.at(index + step) as FormGroup).controls.testFormArrayGroupInput.setValue('next test value 2');
(model.get(index).get(0) as DynamicFormValueControlModel<any>).valueUpdates.next('next test value 1'); (model.get(index).get(0) as DynamicFormValueControlModel<any>).value = 'next test value 1';
(model.get(index + step).get(0) as DynamicFormValueControlModel<any>).valueUpdates.next('next test value 2'); (model.get(index + step).get(0) as DynamicFormValueControlModel<any>).value = 'next test value 2';
service.moveFormArrayGroup(index, step, formArray, model); service.moveFormArrayGroup(index, step, formArray, model);

View File

@@ -88,7 +88,7 @@ export class FormBuilderService extends DynamicFormService {
} }
if (controlModel.hasOwnProperty('valueUpdates')) { if (controlModel.hasOwnProperty('valueUpdates')) {
(controlModel as any).valueUpdates.next(undefined); (controlModel as any).value = undefined;
} }
} }
}; };

View File

@@ -191,7 +191,7 @@ describe('FormComponent test suite', () => {
beforeEach(() => { beforeEach(() => {
formFixture = TestBed.createComponent(FormComponent); formFixture = TestBed.createComponent(FormComponent);
store = TestBed.get(Store); store = TestBed.inject(Store as any);
formComp = formFixture.componentInstance; // FormComponent test instance formComp = formFixture.componentInstance; // FormComponent test instance
formComp.formId = 'testForm'; formComp.formId = 'testForm';
formComp.formModel = TEST_FORM_MODEL; formComp.formModel = TEST_FORM_MODEL;
@@ -382,7 +382,7 @@ describe('FormComponent test suite', () => {
init(); init();
beforeEach(() => { beforeEach(() => {
formFixture = TestBed.createComponent(FormComponent); formFixture = TestBed.createComponent(FormComponent);
store = TestBed.get(Store); store = TestBed.inject(Store as any);
formComp = formFixture.componentInstance; // FormComponent test instance formComp = formFixture.componentInstance; // FormComponent test instance
formComp.formId = 'testFormArray'; formComp.formId = 'testFormArray';
formComp.formModel = TEST_FORM_MODEL_WITH_ARRAY; formComp.formModel = TEST_FORM_MODEL_WITH_ARRAY;

View File

@@ -80,13 +80,13 @@ describe('LangSwitchComponent', () => {
] ]
}).compileComponents() }).compileComponents()
.then(() => { .then(() => {
translate = TestBed.get(TranslateService); translate = TestBed.inject(TranslateService);
translate.addLangs(mockConfig.languages.filter((langConfig: LangConfig) => langConfig.active === true).map((a) => a.code)); translate.addLangs(mockConfig.languages.filter((langConfig: LangConfig) => langConfig.active === true).map((a) => a.code));
translate.setDefaultLang('en'); translate.setDefaultLang('en');
translate.use('en'); translate.use('en');
http = TestBed.get(HttpTestingController); http = TestBed.inject(HttpTestingController);
fixture = TestBed.createComponent(LangSwitchComponent); fixture = TestBed.createComponent(LangSwitchComponent);
localService = TestBed.get(LocaleService); localService = TestBed.inject(LocaleService);
component = fixture.componentInstance; component = fixture.componentInstance;
de = fixture.debugElement; de = fixture.debugElement;
langSwitchElement = de.nativeElement; langSwitchElement = de.nativeElement;
@@ -165,11 +165,11 @@ describe('LangSwitchComponent', () => {
{ provide: LocaleService, useValue: getMockLocaleService() } { provide: LocaleService, useValue: getMockLocaleService() }
] ]
}).compileComponents(); }).compileComponents();
translate = TestBed.get(TranslateService); translate = TestBed.inject(TranslateService);
translate.addLangs(mockConfig.languages.filter((MyLangConfig) => MyLangConfig.active === true).map((a) => a.code)); translate.addLangs(mockConfig.languages.filter((MyLangConfig) => MyLangConfig.active === true).map((a) => a.code));
translate.setDefaultLang('en'); translate.setDefaultLang('en');
translate.use('en'); translate.use('en');
http = TestBed.get(HttpTestingController); http = TestBed.inject(HttpTestingController);
})); }));
beforeEach(() => { beforeEach(() => {

View File

@@ -24,7 +24,7 @@ describe('MenuComponent', () => {
imports: [TranslateModule.forRoot(), NoopAnimationsModule, RouterTestingModule], imports: [TranslateModule.forRoot(), NoopAnimationsModule, RouterTestingModule],
declarations: [MenuComponent], declarations: [MenuComponent],
providers: [ providers: [
{ provide: Injector, useValue: {} }, Injector,
{ provide: MenuService, useClass: MenuServiceStub } { provide: MenuService, useClass: MenuServiceStub }
], ],
schemas: [NO_ERRORS_SCHEMA] schemas: [NO_ERRORS_SCHEMA]
@@ -38,7 +38,7 @@ describe('MenuComponent', () => {
comp = fixture.componentInstance; // SearchPageComponent test instance comp = fixture.componentInstance; // SearchPageComponent test instance
comp.menuID = mockMenuID; comp.menuID = mockMenuID;
menuService = (comp as any).menuService; menuService = (comp as any).menuService;
router = TestBed.get(Router); router = TestBed.inject(Router);
spyOn(comp as any, 'getSectionDataInjector').and.returnValue(MenuSection); spyOn(comp as any, 'getSectionDataInjector').and.returnValue(MenuSection);
spyOn(comp as any, 'getSectionComponent').and.returnValue(observableOf({})); spyOn(comp as any, 'getSectionComponent').and.returnValue(observableOf({}));
fixture.detectChanges(); fixture.detectChanges();

View File

@@ -117,7 +117,7 @@ describe('MenuEffects', () => {
] ]
}); });
menuEffects = TestBed.get(MenuEffects); menuEffects = TestBed.inject(MenuEffects);
}); });
describe('buildRouteMenuSections$', () => { describe('buildRouteMenuSections$', () => {

View File

@@ -95,7 +95,7 @@ describe('MenuService', () => {
})); }));
beforeEach(() => { beforeEach(() => {
store = TestBed.get(Store); store = TestBed.inject(Store);
service = new MenuService(store); service = new MenuService(store);
selectSpy = spyOnProperty(ngrx, 'select').and.callThrough(); selectSpy = spyOnProperty(ngrx, 'select').and.callThrough();
spyOn(store, 'dispatch'); spyOn(store, 'dispatch');

View File

@@ -123,8 +123,8 @@ describe('ClaimedTaskActionsComponent', () => {
fixture = TestBed.createComponent(ClaimedTaskActionsComponent); fixture = TestBed.createComponent(ClaimedTaskActionsComponent);
component = fixture.componentInstance; component = fixture.componentInstance;
component.object = mockObject; component.object = mockObject;
notificationsServiceStub = TestBed.get(NotificationsService); notificationsServiceStub = TestBed.inject(NotificationsService as any);
router = TestBed.get(Router); router = TestBed.inject(Router as any);
fixture.detectChanges(); fixture.detectChanges();
}); });

View File

@@ -51,8 +51,8 @@ describe('ClaimedTaskActionsRejectComponent', () => {
beforeEach(() => { beforeEach(() => {
fixture = TestBed.createComponent(ClaimedTaskActionsRejectComponent); fixture = TestBed.createComponent(ClaimedTaskActionsRejectComponent);
component = fixture.componentInstance; component = fixture.componentInstance;
formBuilder = TestBed.get(FormBuilder); formBuilder = TestBed.inject(FormBuilder);
modalService = TestBed.get(NgbModal); modalService = TestBed.inject(NgbModal);
component.object = object; component.object = object;
component.modalRef = modalService.open('ok'); component.modalRef = modalService.open('ok');
fixture.detectChanges(); fixture.detectChanges();

View File

@@ -101,8 +101,8 @@ describe('PoolTaskActionsComponent', () => {
fixture = TestBed.createComponent(PoolTaskActionsComponent); fixture = TestBed.createComponent(PoolTaskActionsComponent);
component = fixture.componentInstance; component = fixture.componentInstance;
component.object = mockObject; component.object = mockObject;
notificationsServiceStub = TestBed.get(NotificationsService); notificationsServiceStub = TestBed.inject(NotificationsService as any);
router = TestBed.get(Router); router = TestBed.inject(Router as any);
fixture.detectChanges(); fixture.detectChanges();
}); });

View File

@@ -100,7 +100,7 @@ describe('WorkspaceitemActionsComponent', () => {
fixture = TestBed.createComponent(WorkspaceitemActionsComponent); fixture = TestBed.createComponent(WorkspaceitemActionsComponent);
component = fixture.componentInstance; component = fixture.componentInstance;
component.object = mockObject; component.object = mockObject;
notificationsServiceStub = TestBed.get(NotificationsService); notificationsServiceStub = TestBed.inject(NotificationsService as any);
fixture.detectChanges(); fixture.detectChanges();
}); });

View File

@@ -55,7 +55,7 @@ describe('NotificationsService test', () => {
] ]
}); });
service = TestBed.get(NotificationsService); service = TestBed.inject(NotificationsService);
}); });
it('Success method should dispatch NewNotificationAction with proper parameter', () => { it('Success method should dispatch NewNotificationAction with proper parameter', () => {

View File

@@ -113,7 +113,7 @@ describe('EpersonGroupListComponent test suite', () => {
beforeEach(() => { beforeEach(() => {
// initTestScheduler(); // initTestScheduler();
fixture = TestBed.createComponent(EpersonGroupListComponent); fixture = TestBed.createComponent(EpersonGroupListComponent);
epersonService = TestBed.get(EPersonDataService); epersonService = TestBed.inject(EPersonDataService);
comp = fixture.componentInstance; comp = fixture.componentInstance;
compAsAny = fixture.componentInstance; compAsAny = fixture.componentInstance;
comp.isListOfEPerson = true; comp.isListOfEPerson = true;
@@ -190,7 +190,7 @@ describe('EpersonGroupListComponent test suite', () => {
beforeEach(() => { beforeEach(() => {
// initTestScheduler(); // initTestScheduler();
fixture = TestBed.createComponent(EpersonGroupListComponent); fixture = TestBed.createComponent(EpersonGroupListComponent);
groupService = TestBed.get(GroupDataService); groupService = TestBed.inject(GroupDataService);
comp = fixture.componentInstance; comp = fixture.componentInstance;
compAsAny = fixture.componentInstance; compAsAny = fixture.componentInstance;
comp.isListOfEPerson = false; comp.isListOfEPerson = false;

View File

@@ -64,7 +64,7 @@ describe('EpersonSearchBoxComponent test suite', () => {
beforeEach(() => { beforeEach(() => {
// initTestScheduler(); // initTestScheduler();
fixture = TestBed.createComponent(EpersonSearchBoxComponent); fixture = TestBed.createComponent(EpersonSearchBoxComponent);
formBuilder = TestBed.get(FormBuilder); formBuilder = TestBed.inject(FormBuilder);
comp = fixture.componentInstance; comp = fixture.componentInstance;
compAsAny = fixture.componentInstance; compAsAny = fixture.componentInstance;
}); });

View File

@@ -64,7 +64,7 @@ describe('GroupSearchBoxComponent test suite', () => {
beforeEach(() => { beforeEach(() => {
// initTestScheduler(); // initTestScheduler();
fixture = TestBed.createComponent(GroupSearchBoxComponent); fixture = TestBed.createComponent(GroupSearchBoxComponent);
formBuilder = TestBed.get(FormBuilder); formBuilder = TestBed.inject(FormBuilder);
comp = fixture.componentInstance; comp = fixture.componentInstance;
compAsAny = fixture.componentInstance; compAsAny = fixture.componentInstance;
}); });

View File

@@ -219,14 +219,14 @@ export class ResourcePolicyFormComponent implements OnInit, OnDestroy {
formModel.forEach((model: any) => { formModel.forEach((model: any) => {
if (model.id === 'date') { if (model.id === 'date') {
if (hasValue(this.resourcePolicy.startDate)) { if (hasValue(this.resourcePolicy.startDate)) {
model.get(0).valueUpdates.next(stringToNgbDateStruct(this.resourcePolicy.startDate)); model.get(0).value = stringToNgbDateStruct(this.resourcePolicy.startDate);
} }
if (hasValue(this.resourcePolicy.endDate)) { if (hasValue(this.resourcePolicy.endDate)) {
model.get(1).valueUpdates.next(stringToNgbDateStruct(this.resourcePolicy.endDate)); model.get(1).value = stringToNgbDateStruct(this.resourcePolicy.endDate);
} }
} else { } else {
if (this.resourcePolicy.hasOwnProperty(model.id) && this.resourcePolicy[model.id]) { if (this.resourcePolicy.hasOwnProperty(model.id) && this.resourcePolicy[model.id]) {
model.valueUpdates.next(this.resourcePolicy[model.id]); model.value = this.resourcePolicy[model.id];
} }
} }
}) })

View File

@@ -51,7 +51,7 @@ describe('SearchSwitchConfigurationComponent', () => {
beforeEach(() => { beforeEach(() => {
fixture = TestBed.createComponent(SearchSwitchConfigurationComponent); fixture = TestBed.createComponent(SearchSwitchConfigurationComponent);
comp = fixture.componentInstance; comp = fixture.componentInstance;
searchConfService = TestBed.get(SEARCH_CONFIG_SERVICE); searchConfService = TestBed.inject(SEARCH_CONFIG_SERVICE as any);
spyOn(searchConfService, 'getCurrentConfiguration').and.returnValue(observableOf(MyDSpaceConfigurationValueType.Workspace)); spyOn(searchConfService, 'getCurrentConfiguration').and.returnValue(observableOf(MyDSpaceConfigurationValueType.Workspace));

View File

@@ -52,7 +52,7 @@ describe('SidebarFilterService', () => {
})); }));
beforeEach(() => { beforeEach(() => {
store = TestBed.get(Store); store = TestBed.inject(Store);
service = new SidebarFilterService(store); service = new SidebarFilterService(store);
selectSpy = spyOnProperty(ngrx, 'select').and.callThrough(); selectSpy = spyOnProperty(ngrx, 'select').and.callThrough();
spyOn(store, 'dispatch'); spyOn(store, 'dispatch');

View File

@@ -1,9 +1,8 @@
import { EPerson } from '../../core/eperson/models/eperson.model'; import { EPerson } from '../../core/eperson/models/eperson.model';
import { GroupMock } from './group-mock';
export const EPersonMock: EPerson = Object.assign(new EPerson(), { export const EPersonMock: EPerson = Object.assign(new EPerson(), {
handle: null, handle: null,
groups: [GroupMock], groups: [],
netid: 'test@test.com', netid: 'test@test.com',
lastActive: '2018-05-14T12:25:42.411+0000', lastActive: '2018-05-14T12:25:42.411+0000',
canLogIn: true, canLogIn: true,

View File

@@ -178,7 +178,7 @@ describe('VocabularyTreeviewService test suite', () => {
})); }));
beforeEach(() => { beforeEach(() => {
service = TestBed.get(VocabularyTreeviewService); service = TestBed.inject(VocabularyTreeviewService);
serviceAsAny = service; serviceAsAny = service;
scheduler = getTestScheduler(); scheduler = getTestScheduler();
init(); init();

View File

@@ -53,8 +53,8 @@ describe('SubmissionEditComponent Component', () => {
beforeEach(() => { beforeEach(() => {
fixture = TestBed.createComponent(SubmissionEditComponent); fixture = TestBed.createComponent(SubmissionEditComponent);
comp = fixture.componentInstance; comp = fixture.componentInstance;
submissionServiceStub = TestBed.get(SubmissionService); submissionServiceStub = TestBed.inject(SubmissionService as any);
router = TestBed.get(Router); router = TestBed.inject(Router as any);
}); });
afterEach(() => { afterEach(() => {

View File

@@ -169,8 +169,8 @@ describe('SubmissionFormCollectionComponent Component', () => {
fixture = TestBed.createComponent(SubmissionFormCollectionComponent); fixture = TestBed.createComponent(SubmissionFormCollectionComponent);
comp = fixture.componentInstance; comp = fixture.componentInstance;
compAsAny = comp; compAsAny = comp;
submissionServiceStub = TestBed.get(SubmissionService); submissionServiceStub = TestBed.inject(SubmissionService as any);
jsonPatchOpServiceStub = TestBed.get(SubmissionJsonPatchOperationsService); jsonPatchOpServiceStub = TestBed.inject(SubmissionJsonPatchOperationsService as any);
comp.currentCollectionId = collectionId; comp.currentCollectionId = collectionId;
comp.currentDefinition = definition; comp.currentDefinition = definition;
comp.submissionId = submissionId; comp.submissionId = submissionId;

View File

@@ -83,8 +83,8 @@ describe('SubmissionFormFooterComponent Component', () => {
fixture = TestBed.createComponent(SubmissionFormFooterComponent); fixture = TestBed.createComponent(SubmissionFormFooterComponent);
comp = fixture.componentInstance; comp = fixture.componentInstance;
compAsAny = comp; compAsAny = comp;
submissionServiceStub = TestBed.get(SubmissionService); submissionServiceStub = TestBed.inject(SubmissionService as any);
submissionRestServiceStub = TestBed.get(SubmissionRestService); submissionRestServiceStub = TestBed.inject(SubmissionRestService as any);
comp.submissionId = submissionId; comp.submissionId = submissionId;
}); });

View File

@@ -110,8 +110,8 @@ describe('SubmissionFormSectionAddComponent Component', () => {
fixture = TestBed.createComponent(SubmissionFormSectionAddComponent); fixture = TestBed.createComponent(SubmissionFormSectionAddComponent);
comp = fixture.componentInstance; comp = fixture.componentInstance;
compAsAny = comp; compAsAny = comp;
submissionServiceStub = TestBed.get(SubmissionService); submissionServiceStub = TestBed.inject(SubmissionService as any);
sectionsServiceStub = TestBed.get(SectionsService); sectionsServiceStub = TestBed.inject(SectionsService as any);
comp.submissionId = submissionId; comp.submissionId = submissionId;
comp.collectionId = collectionId; comp.collectionId = collectionId;

View File

@@ -89,8 +89,8 @@ describe('SubmissionFormComponent Component', () => {
fixture = TestBed.createComponent(SubmissionFormComponent); fixture = TestBed.createComponent(SubmissionFormComponent);
comp = fixture.componentInstance; comp = fixture.componentInstance;
compAsAny = comp; compAsAny = comp;
submissionServiceStub = TestBed.get(SubmissionService); submissionServiceStub = TestBed.inject(SubmissionService as any);
authServiceStub = TestBed.get(AuthService); authServiceStub = TestBed.inject(AuthService as any);
}); });
afterEach(() => { afterEach(() => {

View File

@@ -106,10 +106,10 @@ describe('SubmissionUploadFilesComponent Component', () => {
fixture = TestBed.createComponent(SubmissionUploadFilesComponent); fixture = TestBed.createComponent(SubmissionUploadFilesComponent);
comp = fixture.componentInstance; comp = fixture.componentInstance;
compAsAny = comp; compAsAny = comp;
submissionServiceStub = TestBed.get(SubmissionService); submissionServiceStub = TestBed.inject(SubmissionService as any);
sectionsServiceStub = TestBed.get(SectionsService); sectionsServiceStub = TestBed.inject(SectionsService as any);
notificationsServiceStub = TestBed.get(NotificationsService); notificationsServiceStub = TestBed.inject(NotificationsService as any);
translateService = TestBed.get(TranslateService); translateService = TestBed.inject(TranslateService);
comp.submissionId = submissionId; comp.submissionId = submissionId;
comp.collectionId = collectionId; comp.collectionId = collectionId;
comp.sectionId = 'upload'; comp.sectionId = 'upload';

View File

@@ -89,7 +89,7 @@ describe('SubmissionImportExternalPreviewComponent test suite', () => {
fixture = TestBed.createComponent(SubmissionImportExternalPreviewComponent); fixture = TestBed.createComponent(SubmissionImportExternalPreviewComponent);
comp = fixture.componentInstance; comp = fixture.componentInstance;
compAsAny = comp; compAsAny = comp;
submissionServiceStub = TestBed.get(SubmissionService); submissionServiceStub = TestBed.inject(SubmissionService as any);
}); });
afterEach(() => { afterEach(() => {

View File

@@ -94,8 +94,8 @@ describe('SubmissionObjectEffects test suite', () => {
], ],
}); });
submissionObjectEffects = TestBed.get(SubmissionObjectEffects); submissionObjectEffects = TestBed.inject(SubmissionObjectEffects);
store = TestBed.get(Store); store = TestBed.inject(Store as any);
}); });
describe('loadForm$', () => { describe('loadForm$', () => {

View File

@@ -54,8 +54,8 @@ describe('SubmissionSectionContainerComponent test suite', () => {
const collectionId = mockSubmissionCollectionId; const collectionId = mockSubmissionCollectionId;
function init() { function init() {
sectionsServiceStub = TestBed.get(SectionsService); sectionsServiceStub = TestBed.inject(SectionsService as any);
submissionServiceStub = TestBed.get(SubmissionService); submissionServiceStub = TestBed.inject(SubmissionService as any);
sectionsServiceStub.isSectionValid.and.returnValue(observableOf(true)); sectionsServiceStub.isSectionValid.and.returnValue(observableOf(true));
sectionsServiceStub.getSectionState.and.returnValue(observableOf(sectionState)); sectionsServiceStub.getSectionState.and.returnValue(observableOf(sectionState));

View File

@@ -78,9 +78,9 @@ describe('SectionFormOperationsService test suite', () => {
})); }));
beforeEach(() => { beforeEach(() => {
service = TestBed.get(SectionFormOperationsService); service = TestBed.inject(SectionFormOperationsService);
serviceAsAny = service; serviceAsAny = service;
formBuilderService = TestBed.get(FormBuilderService); formBuilderService = TestBed.inject(FormBuilderService);
}); });
describe('dispatchOperationsFromEvent', () => { describe('dispatchOperationsFromEvent', () => {

View File

@@ -220,14 +220,14 @@ describe('SubmissionSectionformComponent test suite', () => {
fixture = TestBed.createComponent(SubmissionSectionformComponent); fixture = TestBed.createComponent(SubmissionSectionformComponent);
comp = fixture.componentInstance; comp = fixture.componentInstance;
compAsAny = comp; compAsAny = comp;
submissionServiceStub = TestBed.get(SubmissionService); submissionServiceStub = TestBed.inject(SubmissionService as any);
sectionsServiceStub = TestBed.get(SectionsService); sectionsServiceStub = TestBed.inject(SectionsService as any);
formService = TestBed.get(FormService); formService = TestBed.inject(FormService);
formConfigService = TestBed.get(SubmissionFormsConfigService); formConfigService = TestBed.inject(SubmissionFormsConfigService);
formBuilderService = TestBed.get(FormBuilderService); formBuilderService = TestBed.inject(FormBuilderService);
formOperationsService = TestBed.get(SectionFormOperationsService); formOperationsService = TestBed.inject(SectionFormOperationsService);
translateService = TestBed.get(TranslateService); translateService = TestBed.inject(TranslateService);
notificationsServiceStub = TestBed.get(NotificationsService); notificationsServiceStub = TestBed.inject(NotificationsService as any);
translateService.get.and.returnValue(observableOf('test')); translateService.get.and.returnValue(observableOf('test'));
compAsAny.pathCombiner = new JsonPatchOperationPathCombiner('sections', sectionObject.id); compAsAny.pathCombiner = new JsonPatchOperationPathCombiner('sections', sectionObject.id);

View File

@@ -180,12 +180,12 @@ describe('SubmissionSectionLicenseComponent test suite', () => {
fixture = TestBed.createComponent(SubmissionSectionLicenseComponent); fixture = TestBed.createComponent(SubmissionSectionLicenseComponent);
comp = fixture.componentInstance; comp = fixture.componentInstance;
compAsAny = comp; compAsAny = comp;
submissionServiceStub = TestBed.get(SubmissionService); submissionServiceStub = TestBed.inject(SubmissionService as any);
sectionsServiceStub = TestBed.get(SectionsService); sectionsServiceStub = TestBed.inject(SectionsService as any);
formService = TestBed.get(FormService); formService = TestBed.inject(FormService);
formBuilderService = TestBed.get(FormBuilderService); formBuilderService = TestBed.inject(FormBuilderService);
formOperationsService = TestBed.get(SectionFormOperationsService); formOperationsService = TestBed.inject(SectionFormOperationsService);
collectionDataService = TestBed.get(CollectionDataService); collectionDataService = TestBed.inject(CollectionDataService);
compAsAny.pathCombiner = new JsonPatchOperationPathCombiner('sections', sectionObject.id); compAsAny.pathCombiner = new JsonPatchOperationPathCombiner('sections', sectionObject.id);
}); });
@@ -279,7 +279,7 @@ describe('SubmissionSectionLicenseComponent test suite', () => {
fixture.detectChanges(); fixture.detectChanges();
const model = formBuilderService.findById('granted', comp.formModel); const model = formBuilderService.findById('granted', comp.formModel);
(model as DynamicCheckboxModel).valueUpdates.next(true); (model as DynamicCheckboxModel).value = true;
compAsAny.getSectionStatus().subscribe((status) => { compAsAny.getSectionStatus().subscribe((status) => {
expect(status).toBeTruthy(); expect(status).toBeTruthy();
@@ -299,7 +299,7 @@ describe('SubmissionSectionLicenseComponent test suite', () => {
expect(status).toBeFalsy(); expect(status).toBeFalsy();
}); });
(model as DynamicCheckboxModel).valueUpdates.next(false); (model as DynamicCheckboxModel).value = false;
}); });
it('should dispatch a json-path add operation when checkbox is selected', () => { it('should dispatch a json-path add operation when checkbox is selected', () => {

View File

@@ -82,11 +82,11 @@ describe('SectionsService test suite', () => {
})); }));
beforeEach(() => { beforeEach(() => {
service = TestBed.get(SectionsService); service = TestBed.inject(SectionsService);
submissionServiceStub = TestBed.get(SubmissionService); submissionServiceStub = TestBed.inject(SubmissionService as any);
notificationsServiceStub = TestBed.get(NotificationsService); notificationsServiceStub = TestBed.inject(NotificationsService as any);
scrollToService = TestBed.get(ScrollToService); scrollToService = TestBed.inject(ScrollToService);
translateService = TestBed.get(TranslateService); translateService = TestBed.inject(TranslateService);
}); });
describe('checkSectionErrors', () => { describe('checkSectionErrors', () => {

View File

@@ -115,8 +115,8 @@ describe('SubmissionSectionUploadFileEditComponent test suite', () => {
fixture = TestBed.createComponent(SubmissionSectionUploadFileEditComponent); fixture = TestBed.createComponent(SubmissionSectionUploadFileEditComponent);
comp = fixture.componentInstance; comp = fixture.componentInstance;
compAsAny = comp; compAsAny = comp;
submissionServiceStub = TestBed.get(SubmissionService); submissionServiceStub = TestBed.inject(SubmissionService as any);
formbuilderService = TestBed.get(FormBuilderService); formbuilderService = TestBed.inject(FormBuilderService);
comp.submissionId = submissionId; comp.submissionId = submissionId;
comp.collectionId = collectionId; comp.collectionId = collectionId;

View File

@@ -150,13 +150,13 @@ describe('SubmissionSectionUploadFileComponent test suite', () => {
fixture = TestBed.createComponent(SubmissionSectionUploadFileComponent); fixture = TestBed.createComponent(SubmissionSectionUploadFileComponent);
comp = fixture.componentInstance; comp = fixture.componentInstance;
compAsAny = comp; compAsAny = comp;
submissionServiceStub = TestBed.get(SubmissionService); submissionServiceStub = TestBed.inject(SubmissionService as any);
uploadService = TestBed.get(SectionUploadService); uploadService = TestBed.inject(SectionUploadService);
fileService = TestBed.get(FileService); fileService = TestBed.inject(FileService);
formService = TestBed.get(FormService); formService = TestBed.inject(FormService);
halService = TestBed.get(HALEndpointService); halService = TestBed.inject(HALEndpointService);
operationsBuilder = TestBed.get(JsonPatchOperationsBuilder); operationsBuilder = TestBed.inject(JsonPatchOperationsBuilder);
operationsService = TestBed.get(SubmissionJsonPatchOperationsService); operationsService = TestBed.inject(SubmissionJsonPatchOperationsService);
comp.submissionId = submissionId; comp.submissionId = submissionId;
comp.collectionId = collectionId; comp.collectionId = collectionId;
@@ -237,7 +237,7 @@ describe('SubmissionSectionUploadFileComponent test suite', () => {
})); }));
it('should save Bitstream File data properly when form is valid', fakeAsync(() => { it('should save Bitstream File data properly when form is valid', fakeAsync(() => {
compAsAny.fileEditComp = TestBed.get(SubmissionSectionUploadFileEditComponent); compAsAny.fileEditComp = TestBed.inject(SubmissionSectionUploadFileEditComponent);
compAsAny.fileEditComp.formRef = {formGroup: null}; compAsAny.fileEditComp.formRef = {formGroup: null};
compAsAny.pathCombiner = pathCombiner; compAsAny.pathCombiner = pathCombiner;
const event = new Event('click', null); const event = new Event('click', null);
@@ -292,7 +292,7 @@ describe('SubmissionSectionUploadFileComponent test suite', () => {
})); }));
it('should not save Bitstream File data properly when form is not valid', fakeAsync(() => { it('should not save Bitstream File data properly when form is not valid', fakeAsync(() => {
compAsAny.fileEditComp = TestBed.get(SubmissionSectionUploadFileEditComponent); compAsAny.fileEditComp = TestBed.inject(SubmissionSectionUploadFileEditComponent);
compAsAny.fileEditComp.formRef = {formGroup: null}; compAsAny.fileEditComp.formRef = {formGroup: null};
compAsAny.pathCombiner = pathCombiner; compAsAny.pathCombiner = pathCombiner;
const event = new Event('click', null); const event = new Event('click', null);

View File

@@ -180,13 +180,13 @@ describe('SubmissionSectionUploadComponent test suite', () => {
fixture = TestBed.createComponent(SubmissionSectionUploadComponent); fixture = TestBed.createComponent(SubmissionSectionUploadComponent);
comp = fixture.componentInstance; comp = fixture.componentInstance;
compAsAny = comp; compAsAny = comp;
submissionServiceStub = TestBed.get(SubmissionService); submissionServiceStub = TestBed.inject(SubmissionService as any);
sectionsServiceStub = TestBed.get(SectionsService); sectionsServiceStub = TestBed.inject(SectionsService as any);
collectionDataService = TestBed.get(CollectionDataService); collectionDataService = TestBed.inject(CollectionDataService);
groupService = TestBed.get(GroupDataService); groupService = TestBed.inject(GroupDataService);
resourcePolicyService = TestBed.get(ResourcePolicyService); resourcePolicyService = TestBed.inject(ResourcePolicyService);
uploadsConfigService = TestBed.get(SubmissionUploadsConfigService); uploadsConfigService = TestBed.inject(SubmissionUploadsConfigService);
bitstreamService = TestBed.get(SectionUploadService); bitstreamService = TestBed.inject(SectionUploadService);
}); });
afterEach(() => { afterEach(() => {

View File

@@ -382,7 +382,7 @@ describe('SubmissionService test suite', () => {
})); }));
beforeEach(() => { beforeEach(() => {
service = TestBed.get(SubmissionService); service = TestBed.inject(SubmissionService);
spyOn((service as any).store, 'dispatch').and.callThrough(); spyOn((service as any).store, 'dispatch').and.callThrough();
}); });

View File

@@ -50,8 +50,8 @@ describe('SubmissionSubmitComponent Component', () => {
beforeEach(() => { beforeEach(() => {
fixture = TestBed.createComponent(SubmissionSubmitComponent); fixture = TestBed.createComponent(SubmissionSubmitComponent);
comp = fixture.componentInstance; comp = fixture.componentInstance;
submissionServiceStub = TestBed.get(SubmissionService); submissionServiceStub = TestBed.inject(SubmissionService as any);
router = TestBed.get(Router); router = TestBed.inject(Router as any);
}); });
afterEach(() => { afterEach(() => {

View File

@@ -3,6 +3,11 @@ import 'zone.js/dist/zone';
import 'reflect-metadata'; import 'reflect-metadata';
import { enableProdMode } from '@angular/core'; import { enableProdMode } from '@angular/core';
/******************************************************************
* Load `$localize` - used if i18n tags appear in Angular templates.
*/
import '@angular/localize/init';
import { environment } from './environments/environment'; import { environment } from './environments/environment';
if (environment.production) { if (environment.production) {
@@ -11,4 +16,3 @@ if (environment.production) {
export { ServerAppModule } from './modules/app/server-app.module'; export { ServerAppModule } from './modules/app/server-app.module';
export { ngExpressEngine } from '@nguniversal/express-engine'; export { ngExpressEngine } from '@nguniversal/express-engine';
export { provideModuleMap } from '@nguniversal/module-map-ngfactory-loader';

View File

@@ -24,9 +24,8 @@ import { SubmissionService } from '../../app/submission/submission.service';
import { ServerSubmissionService } from '../../app/submission/server-submission.service'; import { ServerSubmissionService } from '../../app/submission/server-submission.service';
import { Angulartics2DSpace } from '../../app/statistics/angulartics/dspace-provider'; import { Angulartics2DSpace } from '../../app/statistics/angulartics/dspace-provider';
import { Angulartics2RouterlessModule } from 'angulartics2/routerlessmodule'; import { Angulartics2RouterlessModule } from 'angulartics2/routerlessmodule';
import { ModuleMapLoaderModule } from '@nguniversal/module-map-ngfactory-loader'; import { ServerLocaleService } from '../../app/core/locale/server-locale.service';
import { ServerLocaleService } from 'src/app/core/locale/server-locale.service'; import { LocaleService } from '../../app/core/locale/locale.service';
import { LocaleService } from 'src/app/core/locale/locale.service';
import { HTTP_INTERCEPTORS } from '@angular/common/http'; import { HTTP_INTERCEPTORS } from '@angular/common/http';
import { ForwardClientIpInterceptor } from '../../app/core/forward-client-ip/forward-client-ip.interceptor'; import { ForwardClientIpInterceptor } from '../../app/core/forward-client-ip/forward-client-ip.interceptor';
import { HardRedirectService } from '../../app/core/services/hard-redirect.service'; import { HardRedirectService } from '../../app/core/services/hard-redirect.service';
@@ -39,7 +38,6 @@ export function createTranslateLoader() {
@NgModule({ @NgModule({
bootstrap: [AppComponent], bootstrap: [AppComponent],
imports: [ imports: [
ModuleMapLoaderModule,
BrowserModule.withServerTransition({ BrowserModule.withServerTransition({
appId: 'dspace-angular' appId: 'dspace-angular'
}), }),

View File

@@ -62,3 +62,8 @@ import 'core-js/features/reflect';
import 'zone.js/dist/zone'; // Included with Angular CLI. import 'zone.js/dist/zone'; // Included with Angular CLI.
import 'reflect-metadata'; import 'reflect-metadata';
/******************************************************************
* Load `$localize` - used if i18n tags appear in Angular templates.
*/
import '@angular/localize/init';

View File

@@ -10,7 +10,7 @@
"src/polyfills.ts" "src/polyfills.ts"
], ],
"include": [ "include": [
"src/**/*.ts" "src/**/*.d.ts"
], ],
"exclude": [ "exclude": [
"src/test.ts", "src/test.ts",

View File

@@ -2,7 +2,7 @@
"extends": "./tsconfig.app.json", "extends": "./tsconfig.app.json",
"compilerOptions": { "compilerOptions": {
"outDir": "./out-tsc/app-server", "outDir": "./out-tsc/app-server",
"module": "commonjs", "module": "esnext"
}, },
"angularCompilerOptions": { "angularCompilerOptions": {
"entryModule": "./src/modules/app/server-app.module#ServerAppModule" "entryModule": "./src/modules/app/server-app.module#ServerAppModule"

4501
yarn.lock

File diff suppressed because it is too large Load Diff