mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
Changed to use TestBed.inject method instead of deprecated TestBed.get
This commit is contained in:
@@ -56,8 +56,8 @@
|
||||
},
|
||||
{
|
||||
"type": "anyComponentStyle",
|
||||
"maximumWarning": "6kb",
|
||||
"maximumError": "10kb"
|
||||
"maximumWarning": "200kb",
|
||||
"maximumError": "300kb"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
49
package.json
49
package.json
@@ -22,12 +22,17 @@
|
||||
"start:prod": "yarn run build:prod && yarn run serve:ssr",
|
||||
"build": "ng build",
|
||||
"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": "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",
|
||||
"lint": "ng lint",
|
||||
"e2e": "ng e2e",
|
||||
"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:dist": "rimraf dist",
|
||||
"clean:doc": "rimraf doc",
|
||||
@@ -39,10 +44,7 @@
|
||||
"clean": "yarn run clean:prod && yarn run clean:node && yarn run clean:env",
|
||||
"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",
|
||||
"compile:server_bak": "webpack --config webpack.server.config.js --progress --colors",
|
||||
"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"
|
||||
"postinstall": "ngcc"
|
||||
},
|
||||
"browser": {
|
||||
"fs": false,
|
||||
@@ -61,7 +63,7 @@
|
||||
"@angular/compiler": "~9.1.12",
|
||||
"@angular/core": "~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-dynamic": "~9.1.12",
|
||||
"@angular/platform-server": "~9.1.12",
|
||||
@@ -70,25 +72,24 @@
|
||||
"@ng-bootstrap/ng-bootstrap": "6.2.0",
|
||||
"@ng-dynamic-forms/core": "9.1.0",
|
||||
"@ng-dynamic-forms/ui-ng-bootstrap": "9.1.0",
|
||||
"@ngrx/effects": "^8.6.0",
|
||||
"@ngrx/router-store": "^8.6.0",
|
||||
"@ngrx/store": "^8.6.0",
|
||||
"@ngrx/effects": "^9.2.0",
|
||||
"@ngrx/router-store": "^9.2.0",
|
||||
"@ngrx/store": "^9.2.0",
|
||||
"@nguniversal/express-engine": "9.1.1",
|
||||
"@nguniversal/module-map-ngfactory-loader": "v8.2.6",
|
||||
"@ngx-translate/core": "11.0.1",
|
||||
"@ngx-translate/core": "12.1.2",
|
||||
"@nicky-lenaers/ngx-scroll-to": "^9.0.0",
|
||||
"angular-idle-preload": "3.0.0",
|
||||
"angular2-text-mask": "9.0.0",
|
||||
"angulartics2": "7.5.2",
|
||||
"angulartics2": "9.1.0",
|
||||
"bootstrap": "4.3.1",
|
||||
"caniuse-lite": "^1.0.30000697",
|
||||
"cerialize": "0.1.18",
|
||||
"cli-progress": "^3.8.0",
|
||||
"cookie-parser": "1.4.3",
|
||||
"core-js": "^3.6.4",
|
||||
"core-js": "^3.7.0",
|
||||
"debug-loader": "^0.0.1",
|
||||
"deepmerge": "^4.2.2",
|
||||
"express": "4.16.2",
|
||||
"express": "4.17.1",
|
||||
"fast-json-patch": "^2.0.7",
|
||||
"file-saver": "^1.3.8",
|
||||
"filesize": "^6.1.0",
|
||||
@@ -98,39 +99,39 @@
|
||||
"json5": "^2.1.0",
|
||||
"jsonschema": "1.2.2",
|
||||
"jwt-decode": "^2.2.0",
|
||||
"klaro": "^0.6.3",
|
||||
"klaro": "^0.7.8",
|
||||
"moment": "^2.22.1",
|
||||
"morgan": "^1.9.1",
|
||||
"ng-mocks": "^8.1.0",
|
||||
"ng-mocks": "9.6.4",
|
||||
"ng2-file-upload": "1.4.0",
|
||||
"ng2-nouislider": "^1.8.2",
|
||||
"ngx-infinite-scroll": "6.0.1",
|
||||
"ngx-moment": "^3.4.0",
|
||||
"ngx-pagination": "3.0.3",
|
||||
"ngx-sortablejs": "^3.1.4",
|
||||
"ngx-sortablejs": "9.0.0",
|
||||
"nouislider": "^11.0.0",
|
||||
"pem": "1.13.2",
|
||||
"postcss-cli": "^6.0.0",
|
||||
"postcss-cli": "^8.3.0",
|
||||
"reflect-metadata": "^0.1.13",
|
||||
"rxjs": "~6.6.3",
|
||||
"rxjs": "^6.6.3",
|
||||
"rxjs-spy": "^7.5.1",
|
||||
"sass-resources-loader": "^2.0.0",
|
||||
"sortablejs": "1.7.0",
|
||||
"tslib": "^1.10.0",
|
||||
"webfontloader": "1.6.28",
|
||||
"zone.js": "~0.10.2"
|
||||
"zone.js": "^0.10.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@angular-builders/custom-webpack": "8.4.1",
|
||||
"@angular-builders/custom-webpack": "9.2.0",
|
||||
"@angular-devkit/build-angular": "~0.901.12",
|
||||
"@angular/cli": "~9.1.12",
|
||||
"@angular/compiler-cli": "~9.1.12",
|
||||
"@angular/language-service": "~9.1.12",
|
||||
"@fortawesome/fontawesome-free": "^5.5.0",
|
||||
"@ngrx/store-devtools": "^8.6.0",
|
||||
"@ngtools/webpack": "^8.3.25",
|
||||
"@ngrx/store-devtools": "^9.2.0",
|
||||
"@ngtools/webpack": "9.1.12",
|
||||
"@types/deep-freeze": "0.1.1",
|
||||
"@types/express": "^4.17.0",
|
||||
"@types/express": "4.17.9",
|
||||
"@types/file-saver": "^1.3.0",
|
||||
"@types/jasmine": "^3.3.9",
|
||||
"@types/jasminewd2": "~2.0.3",
|
||||
@@ -160,9 +161,9 @@
|
||||
"npm-run-all": "^4.1.5",
|
||||
"optimize-css-assets-webpack-plugin": "^5.0.1",
|
||||
"postcss-apply": "0.11.0",
|
||||
"postcss-cssnext": "3.1.0",
|
||||
"postcss-import": "^12.0.1",
|
||||
"postcss-loader": "^3.0.0",
|
||||
"postcss-preset-env": "6.7.0",
|
||||
"postcss-responsive-type": "1.0.0",
|
||||
"protractor": "^7.0.0",
|
||||
"protractor-istanbul-plugin": "2.0.0",
|
||||
|
@@ -33,7 +33,7 @@ describe('AdminSidebarComponent', () => {
|
||||
imports: [TranslateModule.forRoot(), NoopAnimationsModule, RouterTestingModule],
|
||||
declarations: [AdminSidebarComponent],
|
||||
providers: [
|
||||
{ provide: Injector, useValue: {} },
|
||||
Injector,
|
||||
{ provide: MenuService, useValue: menuService },
|
||||
{ provide: CSSVariableService, useClass: CSSVariableServiceStub },
|
||||
{ provide: AuthService, useClass: AuthServiceStub },
|
||||
|
@@ -84,7 +84,7 @@ describe('BreadcrumbsComponent', () => {
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(BreadcrumbsComponent);
|
||||
component = fixture.componentInstance;
|
||||
router = TestBed.get(Router);
|
||||
router = TestBed.inject(Router);
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
|
@@ -195,7 +195,7 @@ describe('CommunityListService', () => {
|
||||
{ provide: Store, useValue: StoreMock },
|
||||
],
|
||||
});
|
||||
store = TestBed.get(Store);
|
||||
store = TestBed.inject(Store as any);
|
||||
service = new CommunityListService(communityDataServiceStub, collectionDataServiceStub, store);
|
||||
});
|
||||
|
||||
|
@@ -31,7 +31,7 @@ describe('AuthResponseParsingService', () => {
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
store = TestBed.get(Store);
|
||||
store = TestBed.inject(Store);
|
||||
linkServiceStub = jasmine.createSpyObj({
|
||||
removeResolvedLinks: {}
|
||||
});
|
||||
|
@@ -74,8 +74,8 @@ describe('AuthEffects', () => {
|
||||
],
|
||||
});
|
||||
|
||||
authEffects = TestBed.get(AuthEffects);
|
||||
store = TestBed.get(Store);
|
||||
authEffects = TestBed.inject(AuthEffects);
|
||||
store = TestBed.inject(Store as any);
|
||||
});
|
||||
|
||||
describe('authenticate$', () => {
|
||||
|
@@ -42,8 +42,8 @@ describe(`AuthInterceptor`, () => {
|
||||
],
|
||||
});
|
||||
|
||||
service = TestBed.get(DSpaceRESTv2Service);
|
||||
httpMock = TestBed.get(HttpTestingController);
|
||||
service = TestBed.inject(DSpaceRESTv2Service);
|
||||
httpMock = TestBed.inject(HttpTestingController);
|
||||
});
|
||||
|
||||
describe('when has a valid token', () => {
|
||||
|
@@ -112,7 +112,7 @@ describe('AuthService test', () => {
|
||||
AuthService
|
||||
],
|
||||
});
|
||||
authService = TestBed.get(AuthService);
|
||||
authService = TestBed.inject(AuthService);
|
||||
});
|
||||
|
||||
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);
|
||||
storage = (authService as any).storage;
|
||||
routeServiceMock = TestBed.get(RouteService);
|
||||
routerStub = TestBed.get(Router);
|
||||
routeServiceMock = TestBed.inject(RouteService);
|
||||
routerStub = TestBed.inject(Router);
|
||||
spyOn(storage, 'get');
|
||||
spyOn(storage, 'remove');
|
||||
spyOn(storage, 'set');
|
||||
|
@@ -99,7 +99,7 @@ describe('DSOBreadcrumbsService', () => {
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
linkService = TestBed.get(LinkService);
|
||||
linkService = TestBed.inject(LinkService);
|
||||
linkService.resolveLink.and.callFake((object, link) => object);
|
||||
service = new DSOBreadcrumbsService(linkService, dsoNameService);
|
||||
});
|
||||
|
@@ -78,7 +78,7 @@ describe('LinkService', () => {
|
||||
useValue: testDataService
|
||||
}]
|
||||
});
|
||||
service = TestBed.get(LinkService);
|
||||
service = TestBed.inject(LinkService);
|
||||
});
|
||||
|
||||
describe('resolveLink', () => {
|
||||
|
@@ -19,7 +19,7 @@ describe('ObjectCacheEffects', () => {
|
||||
],
|
||||
});
|
||||
|
||||
cacheEffects = TestBed.get(ObjectCacheEffects);
|
||||
cacheEffects = TestBed.inject(ObjectCacheEffects);
|
||||
});
|
||||
|
||||
describe('fixTimestampsOnRehydrate$', () => {
|
||||
|
@@ -66,8 +66,8 @@ describe('ServerSyncBufferEffects', () => {
|
||||
],
|
||||
});
|
||||
|
||||
store = TestBed.get(Store);
|
||||
ssbEffects = TestBed.get(ServerSyncBufferEffects);
|
||||
store = TestBed.inject(Store);
|
||||
ssbEffects = TestBed.inject(ServerSyncBufferEffects);
|
||||
});
|
||||
|
||||
describe('setTimeoutForServerSync', () => {
|
||||
|
@@ -44,7 +44,7 @@ describe('ObjectUpdatesEffects', () => {
|
||||
beforeEach(() => {
|
||||
testURL = 'www.dspace.org/dspace7';
|
||||
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).notificationActionMap$[fakeID] = new Subject<ObjectUpdatesAction>();
|
||||
(updatesEffects as any).notificationActionMap$[(updatesEffects as any).allIdentifier] = new Subject<ObjectUpdatesAction>();
|
||||
|
@@ -22,8 +22,8 @@ describe('DSpaceRESTv2Service', () => {
|
||||
providers: [DSpaceRESTv2Service]
|
||||
});
|
||||
|
||||
dSpaceRESTv2Service = TestBed.get(DSpaceRESTv2Service);
|
||||
httpMock = TestBed.get(HttpTestingController);
|
||||
dSpaceRESTv2Service = TestBed.inject(DSpaceRESTv2Service);
|
||||
httpMock = TestBed.inject(HttpTestingController);
|
||||
});
|
||||
|
||||
afterEach(() => httpMock.verify());
|
||||
|
@@ -29,8 +29,8 @@ describe('ForwardClientIpInterceptor', () => {
|
||||
],
|
||||
});
|
||||
|
||||
service = TestBed.get(DSpaceRESTv2Service);
|
||||
httpMock = TestBed.get(HttpTestingController);
|
||||
service = TestBed.inject(DSpaceRESTv2Service);
|
||||
httpMock = TestBed.inject(HttpTestingController);
|
||||
});
|
||||
|
||||
it('should add an X-Forwarded-For header matching the client\'s IP', () => {
|
||||
|
@@ -32,7 +32,7 @@ describe('JsonPatchOperationsEffects test suite', () => {
|
||||
],
|
||||
});
|
||||
|
||||
jsonPatchOperationsEffects = TestBed.get(JsonPatchOperationsEffects);
|
||||
jsonPatchOperationsEffects = TestBed.inject(JsonPatchOperationsEffects);
|
||||
});
|
||||
|
||||
describe('commit$', () => {
|
||||
|
@@ -34,9 +34,9 @@ describe(`LocaleInterceptor`, () => {
|
||||
],
|
||||
});
|
||||
|
||||
service = TestBed.get(DSpaceRESTv2Service);
|
||||
httpMock = TestBed.get(HttpTestingController);
|
||||
localeService = TestBed.get(LocaleService);
|
||||
service = TestBed.inject(DSpaceRESTv2Service);
|
||||
httpMock = TestBed.inject(HttpTestingController);
|
||||
localeService = TestBed.inject(LocaleService);
|
||||
|
||||
localeService.getCurrentLanguageCode.and.returnValue('en')
|
||||
});
|
||||
|
@@ -40,9 +40,9 @@ describe('LocaleService test suite', () => {
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
cookieService = TestBed.get(CookieService);
|
||||
translateService = TestBed.get(TranslateService);
|
||||
authService = TestBed.get(TranslateService);
|
||||
cookieService = TestBed.inject(CookieService);
|
||||
translateService = TestBed.inject(TranslateService);
|
||||
authService = TestBed.inject(AuthService);
|
||||
window = new NativeWindowRef();
|
||||
service = new LocaleService(window, cookieService, translateService, authService);
|
||||
serviceAsAny = service;
|
||||
|
@@ -179,14 +179,14 @@ describe('MetadataService', () => {
|
||||
],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
||||
});
|
||||
meta = TestBed.get(Meta);
|
||||
title = TestBed.get(Title);
|
||||
itemDataService = TestBed.get(ItemDataService);
|
||||
metadataService = TestBed.get(MetadataService);
|
||||
authService = TestBed.get(AuthService);
|
||||
meta = TestBed.inject(Meta);
|
||||
title = TestBed.inject(Title);
|
||||
itemDataService = TestBed.inject(ItemDataService);
|
||||
metadataService = TestBed.inject(MetadataService);
|
||||
authService = TestBed.inject(AuthService);
|
||||
|
||||
router = TestBed.get(Router);
|
||||
location = TestBed.get(Location);
|
||||
router = TestBed.inject(Router);
|
||||
location = TestBed.inject(Location);
|
||||
|
||||
fixture = TestBed.createComponent(TestComponent);
|
||||
|
||||
|
@@ -156,8 +156,8 @@ describe('RegistryService', () => {
|
||||
RegistryService
|
||||
]
|
||||
});
|
||||
registryService = TestBed.get(RegistryService);
|
||||
mockStore = TestBed.get(Store);
|
||||
registryService = TestBed.inject(RegistryService);
|
||||
mockStore = TestBed.inject(Store);
|
||||
});
|
||||
|
||||
describe('when requesting metadataschemas', () => {
|
||||
|
@@ -15,7 +15,7 @@ describe(CookieService.name, () => {
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
service = TestBed.get(CookieService)
|
||||
service = TestBed.inject(CookieService)
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
|
@@ -10,7 +10,7 @@ describe('HardRedirectService', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({ providers: [TestHardRedirectService] });
|
||||
service = TestBed.get(TestHardRedirectService);
|
||||
service = TestBed.inject(TestHardRedirectService);
|
||||
});
|
||||
|
||||
describe('when calling rewriteDownloadURL', () => {
|
||||
|
@@ -53,7 +53,7 @@ describe('RouteService', () => {
|
||||
}));
|
||||
|
||||
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;
|
||||
});
|
||||
|
||||
|
@@ -58,7 +58,7 @@ describe('SearchService', () => {
|
||||
SearchService
|
||||
],
|
||||
});
|
||||
searchService = TestBed.get(SearchService);
|
||||
searchService = TestBed.inject(SearchService);
|
||||
});
|
||||
|
||||
it('should return list view mode', () => {
|
||||
@@ -115,8 +115,8 @@ describe('SearchService', () => {
|
||||
SearchService
|
||||
],
|
||||
});
|
||||
searchService = TestBed.get(SearchService);
|
||||
routeService = TestBed.get(RouteService);
|
||||
searchService = TestBed.inject(SearchService);
|
||||
routeService = TestBed.inject(RouteService);
|
||||
const urlTree = Object.assign(new UrlTree(), { root: { children: { primary: 'search' } } });
|
||||
router.parseUrl.and.returnValue(urlTree);
|
||||
});
|
||||
|
@@ -30,7 +30,7 @@ describe('NavbarComponent', () => {
|
||||
RouterTestingModule],
|
||||
declarations: [NavbarComponent],
|
||||
providers: [
|
||||
{ provide: Injector, useValue: {} },
|
||||
Injector,
|
||||
{ provide: MenuService, useValue: menuService },
|
||||
{ provide: HostWindowService, useValue: new HostWindowServiceStub(800) },
|
||||
{ provide: ActivatedRoute, useValue: {} }
|
||||
|
@@ -25,7 +25,7 @@ describe('NavbarEffects', () => {
|
||||
],
|
||||
});
|
||||
|
||||
navbarEffects = TestBed.get(NavbarEffects);
|
||||
navbarEffects = TestBed.inject(NavbarEffects);
|
||||
});
|
||||
|
||||
describe('resize$', () => {
|
||||
|
@@ -67,7 +67,7 @@ describe('BrowserKlaroService', () => {
|
||||
}
|
||||
]
|
||||
});
|
||||
service = TestBed.get(BrowserKlaroService);
|
||||
service = TestBed.inject(BrowserKlaroService);
|
||||
appName = 'testName';
|
||||
purpose = 'test purpose';
|
||||
testKey = 'this.is.a.fake.message.key';
|
||||
|
@@ -69,7 +69,7 @@ export class BrowserKlaroService extends KlaroService {
|
||||
|
||||
const translationServiceReady$ = this.translateService.get('loading.default').pipe(take(1));
|
||||
|
||||
observableCombineLatest(user$, translationServiceReady$)
|
||||
observableCombineLatest([user$, translationServiceReady$])
|
||||
.subscribe(([user, translation]: [EPerson, string]) => {
|
||||
user = cloneDeep(user);
|
||||
|
||||
|
@@ -112,7 +112,7 @@ describe('ExportMetadataSelectorComponent', () => {
|
||||
fixture = TestBed.createComponent(ExportMetadataSelectorComponent);
|
||||
component = fixture.componentInstance;
|
||||
debugElement = fixture.debugElement;
|
||||
const modalService = TestBed.get(NgbModal);
|
||||
const modalService = TestBed.inject(NgbModal);
|
||||
modalRef = modalService.open(ConfirmationModalComponent);
|
||||
modalRef.componentInstance.response = observableOf(true);
|
||||
fixture.detectChanges();
|
||||
|
@@ -194,7 +194,7 @@ describe('DsDynamicFormControlContainerComponent test suite', () => {
|
||||
|
||||
fixture = TestBed.createComponent(DsDynamicFormControlContainerComponent);
|
||||
|
||||
const ngZone = TestBed.get(NgZone);
|
||||
const ngZone = TestBed.inject(NgZone);
|
||||
|
||||
// tslint:disable-next-line:ban-types
|
||||
spyOn(ngZone, 'runOutsideAngular').and.callFake((fn: Function) => fn());
|
||||
@@ -283,7 +283,7 @@ describe('DsDynamicFormControlContainerComponent test suite', () => {
|
||||
|
||||
spyOn(component, 'onModelValueUpdates');
|
||||
|
||||
(testModel as DynamicInputModel).valueUpdates.next('test');
|
||||
(testModel as DynamicInputModel).value = 'test';
|
||||
|
||||
expect(component.onModelValueUpdates).toHaveBeenCalled();
|
||||
});
|
||||
@@ -292,7 +292,7 @@ describe('DsDynamicFormControlContainerComponent test suite', () => {
|
||||
|
||||
spyOn(component, 'onModelDisabledUpdates');
|
||||
|
||||
testModel.disabledUpdates.next(true);
|
||||
testModel.disabled = true;
|
||||
|
||||
expect(component.onModelDisabledUpdates).toHaveBeenCalled();
|
||||
});
|
||||
|
@@ -66,7 +66,7 @@ export class DsDynamicLookupComponent extends DsDynamicVocabularyComponent imple
|
||||
this.setCurrentValue(this.model.value, true);
|
||||
}
|
||||
|
||||
this.subs.push(this.model.valueUpdates
|
||||
this.subs.push(this.model.valueChanges
|
||||
.subscribe((value) => {
|
||||
if (isEmpty(value)) {
|
||||
this.resetFields();
|
||||
|
@@ -378,7 +378,7 @@ describe('DsDynamicOneboxComponent test suite', () => {
|
||||
spyOn(vocabularyServiceStub, 'findVocabularyById').and.returnValue(createSuccessfulRemoteDataObject$(hierarchicalVocabulary));
|
||||
oneboxCompFixture = TestBed.createComponent(DsDynamicOneboxComponent);
|
||||
oneboxComponent = oneboxCompFixture.componentInstance; // FormComponent test instance
|
||||
modalService = TestBed.get(NgbModal);
|
||||
modalService = TestBed.inject(NgbModal);
|
||||
modalService.open.and.returnValue(new MockNgbModalRef());
|
||||
});
|
||||
|
||||
|
@@ -222,7 +222,7 @@ export class DsDynamicRelationGroupComponent extends DynamicFormControlComponent
|
||||
if (this.model.isEmpty()) {
|
||||
this.initChips([]);
|
||||
} else {
|
||||
initChipsValue$ = observableOf(this.model.value);
|
||||
initChipsValue$ = observableOf(this.model.value as any[]);
|
||||
|
||||
// If authority
|
||||
this.subs.push(initChipsValue$.pipe(
|
||||
@@ -274,7 +274,7 @@ export class DsDynamicRelationGroupComponent extends DynamicFormControlComponent
|
||||
}
|
||||
return acc;
|
||||
}, []),
|
||||
filter((modelValues: any[]) => this.model.value.length === modelValues.length)
|
||||
filter((modelValues: any[]) => (this.model.value as any[]).length === modelValues.length)
|
||||
).subscribe((modelValue) => {
|
||||
this.model.value = modelValue;
|
||||
this.initChips(modelValue);
|
||||
|
@@ -41,13 +41,9 @@ export class DynamicRelationGroupModel extends DsDynamicInputModel {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
get value() {
|
||||
return this.value
|
||||
}
|
||||
|
||||
set value(value) {
|
||||
this.value = (isEmpty(value)) ? null : value;
|
||||
}
|
||||
/* get value() {
|
||||
return (isEmpty(this.value)) ? null : this.value
|
||||
}*/
|
||||
|
||||
isEmpty() {
|
||||
const value = this.getGroupValue();
|
||||
@@ -67,6 +63,6 @@ export class DynamicRelationGroupModel extends DsDynamicInputModel {
|
||||
});
|
||||
return [emptyItem];
|
||||
}
|
||||
return this.value
|
||||
return this.value as any[]
|
||||
}
|
||||
}
|
||||
|
@@ -116,7 +116,7 @@ describe('RelationshipEffects', () => {
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
relationEffects = TestBed.get(RelationshipEffects);
|
||||
relationEffects = TestBed.inject(RelationshipEffects);
|
||||
identifier = (relationEffects as any).createIdentifier(leftItem, rightItem, relationshipType.leftwardType);
|
||||
});
|
||||
|
||||
|
@@ -446,14 +446,14 @@ describe('FormBuilderService test suite', () => {
|
||||
|
||||
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 = {
|
||||
issue: [new FormFieldMetadataValueObject('test')]
|
||||
};
|
||||
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 = {
|
||||
issue: [new FormFieldMetadataValueObject('test')],
|
||||
conference: [new FormFieldMetadataValueObject('test one')]
|
||||
@@ -465,8 +465,8 @@ describe('FormBuilderService test suite', () => {
|
||||
const formModel = service.modelFromConfiguration(submissionId, testFormConfiguration, 'testScopeUUID');
|
||||
const value = {} as any;
|
||||
|
||||
((formModel[0] as DynamicRowGroupModel).get(1) as DsDynamicInputModel).valueUpdates.next('test');
|
||||
((formModel[2] as DynamicRowGroupModel).get(0) as DynamicOneboxModel).valueUpdates.next('test one');
|
||||
((formModel[0] as DynamicRowGroupModel).get(1) as DsDynamicInputModel).value = 'test';
|
||||
((formModel[2] as DynamicRowGroupModel).get(0) as DynamicOneboxModel).value = 'test one';
|
||||
|
||||
service.clearAllModelsValue(formModel);
|
||||
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 + 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 + step).get(0) as DynamicFormValueControlModel<any>).valueUpdates.next('next test value 2');
|
||||
(model.get(index).get(0) as DynamicFormValueControlModel<any>).value = 'next test value 1';
|
||||
(model.get(index + step).get(0) as DynamicFormValueControlModel<any>).value = 'next test value 2';
|
||||
|
||||
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 + 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 + step).get(0) as DynamicFormValueControlModel<any>).valueUpdates.next('next test value 2');
|
||||
(model.get(index).get(0) as DynamicFormValueControlModel<any>).value = 'next test value 1';
|
||||
(model.get(index + step).get(0) as DynamicFormValueControlModel<any>).value = 'next test value 2';
|
||||
|
||||
service.moveFormArrayGroup(index, step, formArray, model);
|
||||
|
||||
|
@@ -88,7 +88,7 @@ export class FormBuilderService extends DynamicFormService {
|
||||
}
|
||||
|
||||
if (controlModel.hasOwnProperty('valueUpdates')) {
|
||||
(controlModel as any).valueUpdates.next(undefined);
|
||||
(controlModel as any).value = undefined;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@@ -191,7 +191,7 @@ describe('FormComponent test suite', () => {
|
||||
beforeEach(() => {
|
||||
|
||||
formFixture = TestBed.createComponent(FormComponent);
|
||||
store = TestBed.get(Store);
|
||||
store = TestBed.inject(Store as any);
|
||||
formComp = formFixture.componentInstance; // FormComponent test instance
|
||||
formComp.formId = 'testForm';
|
||||
formComp.formModel = TEST_FORM_MODEL;
|
||||
@@ -382,7 +382,7 @@ describe('FormComponent test suite', () => {
|
||||
init();
|
||||
beforeEach(() => {
|
||||
formFixture = TestBed.createComponent(FormComponent);
|
||||
store = TestBed.get(Store);
|
||||
store = TestBed.inject(Store as any);
|
||||
formComp = formFixture.componentInstance; // FormComponent test instance
|
||||
formComp.formId = 'testFormArray';
|
||||
formComp.formModel = TEST_FORM_MODEL_WITH_ARRAY;
|
||||
|
@@ -80,13 +80,13 @@ describe('LangSwitchComponent', () => {
|
||||
]
|
||||
}).compileComponents()
|
||||
.then(() => {
|
||||
translate = TestBed.get(TranslateService);
|
||||
translate = TestBed.inject(TranslateService);
|
||||
translate.addLangs(mockConfig.languages.filter((langConfig: LangConfig) => langConfig.active === true).map((a) => a.code));
|
||||
translate.setDefaultLang('en');
|
||||
translate.use('en');
|
||||
http = TestBed.get(HttpTestingController);
|
||||
http = TestBed.inject(HttpTestingController);
|
||||
fixture = TestBed.createComponent(LangSwitchComponent);
|
||||
localService = TestBed.get(LocaleService);
|
||||
localService = TestBed.inject(LocaleService);
|
||||
component = fixture.componentInstance;
|
||||
de = fixture.debugElement;
|
||||
langSwitchElement = de.nativeElement;
|
||||
@@ -165,11 +165,11 @@ describe('LangSwitchComponent', () => {
|
||||
{ provide: LocaleService, useValue: getMockLocaleService() }
|
||||
]
|
||||
}).compileComponents();
|
||||
translate = TestBed.get(TranslateService);
|
||||
translate = TestBed.inject(TranslateService);
|
||||
translate.addLangs(mockConfig.languages.filter((MyLangConfig) => MyLangConfig.active === true).map((a) => a.code));
|
||||
translate.setDefaultLang('en');
|
||||
translate.use('en');
|
||||
http = TestBed.get(HttpTestingController);
|
||||
http = TestBed.inject(HttpTestingController);
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
|
@@ -24,7 +24,7 @@ describe('MenuComponent', () => {
|
||||
imports: [TranslateModule.forRoot(), NoopAnimationsModule, RouterTestingModule],
|
||||
declarations: [MenuComponent],
|
||||
providers: [
|
||||
{ provide: Injector, useValue: {} },
|
||||
Injector,
|
||||
{ provide: MenuService, useClass: MenuServiceStub }
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
@@ -38,7 +38,7 @@ describe('MenuComponent', () => {
|
||||
comp = fixture.componentInstance; // SearchPageComponent test instance
|
||||
comp.menuID = mockMenuID;
|
||||
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, 'getSectionComponent').and.returnValue(observableOf({}));
|
||||
fixture.detectChanges();
|
||||
|
@@ -117,7 +117,7 @@ describe('MenuEffects', () => {
|
||||
]
|
||||
});
|
||||
|
||||
menuEffects = TestBed.get(MenuEffects);
|
||||
menuEffects = TestBed.inject(MenuEffects);
|
||||
});
|
||||
|
||||
describe('buildRouteMenuSections$', () => {
|
||||
|
@@ -95,7 +95,7 @@ describe('MenuService', () => {
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
store = TestBed.get(Store);
|
||||
store = TestBed.inject(Store);
|
||||
service = new MenuService(store);
|
||||
selectSpy = spyOnProperty(ngrx, 'select').and.callThrough();
|
||||
spyOn(store, 'dispatch');
|
||||
|
@@ -123,8 +123,8 @@ describe('ClaimedTaskActionsComponent', () => {
|
||||
fixture = TestBed.createComponent(ClaimedTaskActionsComponent);
|
||||
component = fixture.componentInstance;
|
||||
component.object = mockObject;
|
||||
notificationsServiceStub = TestBed.get(NotificationsService);
|
||||
router = TestBed.get(Router);
|
||||
notificationsServiceStub = TestBed.inject(NotificationsService as any);
|
||||
router = TestBed.inject(Router as any);
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
|
@@ -51,8 +51,8 @@ describe('ClaimedTaskActionsRejectComponent', () => {
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ClaimedTaskActionsRejectComponent);
|
||||
component = fixture.componentInstance;
|
||||
formBuilder = TestBed.get(FormBuilder);
|
||||
modalService = TestBed.get(NgbModal);
|
||||
formBuilder = TestBed.inject(FormBuilder);
|
||||
modalService = TestBed.inject(NgbModal);
|
||||
component.object = object;
|
||||
component.modalRef = modalService.open('ok');
|
||||
fixture.detectChanges();
|
||||
|
@@ -101,8 +101,8 @@ describe('PoolTaskActionsComponent', () => {
|
||||
fixture = TestBed.createComponent(PoolTaskActionsComponent);
|
||||
component = fixture.componentInstance;
|
||||
component.object = mockObject;
|
||||
notificationsServiceStub = TestBed.get(NotificationsService);
|
||||
router = TestBed.get(Router);
|
||||
notificationsServiceStub = TestBed.inject(NotificationsService as any);
|
||||
router = TestBed.inject(Router as any);
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
|
@@ -100,7 +100,7 @@ describe('WorkspaceitemActionsComponent', () => {
|
||||
fixture = TestBed.createComponent(WorkspaceitemActionsComponent);
|
||||
component = fixture.componentInstance;
|
||||
component.object = mockObject;
|
||||
notificationsServiceStub = TestBed.get(NotificationsService);
|
||||
notificationsServiceStub = TestBed.inject(NotificationsService as any);
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
|
@@ -55,7 +55,7 @@ describe('NotificationsService test', () => {
|
||||
]
|
||||
});
|
||||
|
||||
service = TestBed.get(NotificationsService);
|
||||
service = TestBed.inject(NotificationsService);
|
||||
});
|
||||
|
||||
it('Success method should dispatch NewNotificationAction with proper parameter', () => {
|
||||
|
@@ -113,7 +113,7 @@ describe('EpersonGroupListComponent test suite', () => {
|
||||
beforeEach(() => {
|
||||
// initTestScheduler();
|
||||
fixture = TestBed.createComponent(EpersonGroupListComponent);
|
||||
epersonService = TestBed.get(EPersonDataService);
|
||||
epersonService = TestBed.inject(EPersonDataService);
|
||||
comp = fixture.componentInstance;
|
||||
compAsAny = fixture.componentInstance;
|
||||
comp.isListOfEPerson = true;
|
||||
@@ -190,7 +190,7 @@ describe('EpersonGroupListComponent test suite', () => {
|
||||
beforeEach(() => {
|
||||
// initTestScheduler();
|
||||
fixture = TestBed.createComponent(EpersonGroupListComponent);
|
||||
groupService = TestBed.get(GroupDataService);
|
||||
groupService = TestBed.inject(GroupDataService);
|
||||
comp = fixture.componentInstance;
|
||||
compAsAny = fixture.componentInstance;
|
||||
comp.isListOfEPerson = false;
|
||||
|
@@ -64,7 +64,7 @@ describe('EpersonSearchBoxComponent test suite', () => {
|
||||
beforeEach(() => {
|
||||
// initTestScheduler();
|
||||
fixture = TestBed.createComponent(EpersonSearchBoxComponent);
|
||||
formBuilder = TestBed.get(FormBuilder);
|
||||
formBuilder = TestBed.inject(FormBuilder);
|
||||
comp = fixture.componentInstance;
|
||||
compAsAny = fixture.componentInstance;
|
||||
});
|
||||
|
@@ -64,7 +64,7 @@ describe('GroupSearchBoxComponent test suite', () => {
|
||||
beforeEach(() => {
|
||||
// initTestScheduler();
|
||||
fixture = TestBed.createComponent(GroupSearchBoxComponent);
|
||||
formBuilder = TestBed.get(FormBuilder);
|
||||
formBuilder = TestBed.inject(FormBuilder);
|
||||
comp = fixture.componentInstance;
|
||||
compAsAny = fixture.componentInstance;
|
||||
});
|
||||
|
@@ -219,14 +219,14 @@ export class ResourcePolicyFormComponent implements OnInit, OnDestroy {
|
||||
formModel.forEach((model: any) => {
|
||||
if (model.id === 'date') {
|
||||
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)) {
|
||||
model.get(1).valueUpdates.next(stringToNgbDateStruct(this.resourcePolicy.endDate));
|
||||
model.get(1).value = stringToNgbDateStruct(this.resourcePolicy.endDate);
|
||||
}
|
||||
} else {
|
||||
if (this.resourcePolicy.hasOwnProperty(model.id) && this.resourcePolicy[model.id]) {
|
||||
model.valueUpdates.next(this.resourcePolicy[model.id]);
|
||||
model.value = this.resourcePolicy[model.id];
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@@ -51,7 +51,7 @@ describe('SearchSwitchConfigurationComponent', () => {
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(SearchSwitchConfigurationComponent);
|
||||
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));
|
||||
|
||||
|
@@ -52,7 +52,7 @@ describe('SidebarFilterService', () => {
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
store = TestBed.get(Store);
|
||||
store = TestBed.inject(Store);
|
||||
service = new SidebarFilterService(store);
|
||||
selectSpy = spyOnProperty(ngrx, 'select').and.callThrough();
|
||||
spyOn(store, 'dispatch');
|
||||
|
@@ -1,9 +1,8 @@
|
||||
import { EPerson } from '../../core/eperson/models/eperson.model';
|
||||
import { GroupMock } from './group-mock';
|
||||
|
||||
export const EPersonMock: EPerson = Object.assign(new EPerson(), {
|
||||
handle: null,
|
||||
groups: [GroupMock],
|
||||
groups: [],
|
||||
netid: 'test@test.com',
|
||||
lastActive: '2018-05-14T12:25:42.411+0000',
|
||||
canLogIn: true,
|
||||
|
@@ -178,7 +178,7 @@ describe('VocabularyTreeviewService test suite', () => {
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
service = TestBed.get(VocabularyTreeviewService);
|
||||
service = TestBed.inject(VocabularyTreeviewService);
|
||||
serviceAsAny = service;
|
||||
scheduler = getTestScheduler();
|
||||
init();
|
||||
|
@@ -53,8 +53,8 @@ describe('SubmissionEditComponent Component', () => {
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(SubmissionEditComponent);
|
||||
comp = fixture.componentInstance;
|
||||
submissionServiceStub = TestBed.get(SubmissionService);
|
||||
router = TestBed.get(Router);
|
||||
submissionServiceStub = TestBed.inject(SubmissionService as any);
|
||||
router = TestBed.inject(Router as any);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
|
@@ -169,8 +169,8 @@ describe('SubmissionFormCollectionComponent Component', () => {
|
||||
fixture = TestBed.createComponent(SubmissionFormCollectionComponent);
|
||||
comp = fixture.componentInstance;
|
||||
compAsAny = comp;
|
||||
submissionServiceStub = TestBed.get(SubmissionService);
|
||||
jsonPatchOpServiceStub = TestBed.get(SubmissionJsonPatchOperationsService);
|
||||
submissionServiceStub = TestBed.inject(SubmissionService as any);
|
||||
jsonPatchOpServiceStub = TestBed.inject(SubmissionJsonPatchOperationsService as any);
|
||||
comp.currentCollectionId = collectionId;
|
||||
comp.currentDefinition = definition;
|
||||
comp.submissionId = submissionId;
|
||||
|
@@ -83,8 +83,8 @@ describe('SubmissionFormFooterComponent Component', () => {
|
||||
fixture = TestBed.createComponent(SubmissionFormFooterComponent);
|
||||
comp = fixture.componentInstance;
|
||||
compAsAny = comp;
|
||||
submissionServiceStub = TestBed.get(SubmissionService);
|
||||
submissionRestServiceStub = TestBed.get(SubmissionRestService);
|
||||
submissionServiceStub = TestBed.inject(SubmissionService as any);
|
||||
submissionRestServiceStub = TestBed.inject(SubmissionRestService as any);
|
||||
comp.submissionId = submissionId;
|
||||
|
||||
});
|
||||
|
@@ -110,8 +110,8 @@ describe('SubmissionFormSectionAddComponent Component', () => {
|
||||
fixture = TestBed.createComponent(SubmissionFormSectionAddComponent);
|
||||
comp = fixture.componentInstance;
|
||||
compAsAny = comp;
|
||||
submissionServiceStub = TestBed.get(SubmissionService);
|
||||
sectionsServiceStub = TestBed.get(SectionsService);
|
||||
submissionServiceStub = TestBed.inject(SubmissionService as any);
|
||||
sectionsServiceStub = TestBed.inject(SectionsService as any);
|
||||
comp.submissionId = submissionId;
|
||||
comp.collectionId = collectionId;
|
||||
|
||||
|
@@ -89,8 +89,8 @@ describe('SubmissionFormComponent Component', () => {
|
||||
fixture = TestBed.createComponent(SubmissionFormComponent);
|
||||
comp = fixture.componentInstance;
|
||||
compAsAny = comp;
|
||||
submissionServiceStub = TestBed.get(SubmissionService);
|
||||
authServiceStub = TestBed.get(AuthService);
|
||||
submissionServiceStub = TestBed.inject(SubmissionService as any);
|
||||
authServiceStub = TestBed.inject(AuthService as any);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
|
@@ -106,10 +106,10 @@ describe('SubmissionUploadFilesComponent Component', () => {
|
||||
fixture = TestBed.createComponent(SubmissionUploadFilesComponent);
|
||||
comp = fixture.componentInstance;
|
||||
compAsAny = comp;
|
||||
submissionServiceStub = TestBed.get(SubmissionService);
|
||||
sectionsServiceStub = TestBed.get(SectionsService);
|
||||
notificationsServiceStub = TestBed.get(NotificationsService);
|
||||
translateService = TestBed.get(TranslateService);
|
||||
submissionServiceStub = TestBed.inject(SubmissionService as any);
|
||||
sectionsServiceStub = TestBed.inject(SectionsService as any);
|
||||
notificationsServiceStub = TestBed.inject(NotificationsService as any);
|
||||
translateService = TestBed.inject(TranslateService);
|
||||
comp.submissionId = submissionId;
|
||||
comp.collectionId = collectionId;
|
||||
comp.sectionId = 'upload';
|
||||
|
@@ -89,7 +89,7 @@ describe('SubmissionImportExternalPreviewComponent test suite', () => {
|
||||
fixture = TestBed.createComponent(SubmissionImportExternalPreviewComponent);
|
||||
comp = fixture.componentInstance;
|
||||
compAsAny = comp;
|
||||
submissionServiceStub = TestBed.get(SubmissionService);
|
||||
submissionServiceStub = TestBed.inject(SubmissionService as any);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
|
@@ -94,8 +94,8 @@ describe('SubmissionObjectEffects test suite', () => {
|
||||
],
|
||||
});
|
||||
|
||||
submissionObjectEffects = TestBed.get(SubmissionObjectEffects);
|
||||
store = TestBed.get(Store);
|
||||
submissionObjectEffects = TestBed.inject(SubmissionObjectEffects);
|
||||
store = TestBed.inject(Store as any);
|
||||
});
|
||||
|
||||
describe('loadForm$', () => {
|
||||
|
@@ -54,8 +54,8 @@ describe('SubmissionSectionContainerComponent test suite', () => {
|
||||
const collectionId = mockSubmissionCollectionId;
|
||||
|
||||
function init() {
|
||||
sectionsServiceStub = TestBed.get(SectionsService);
|
||||
submissionServiceStub = TestBed.get(SubmissionService);
|
||||
sectionsServiceStub = TestBed.inject(SectionsService as any);
|
||||
submissionServiceStub = TestBed.inject(SubmissionService as any);
|
||||
|
||||
sectionsServiceStub.isSectionValid.and.returnValue(observableOf(true));
|
||||
sectionsServiceStub.getSectionState.and.returnValue(observableOf(sectionState));
|
||||
|
@@ -78,9 +78,9 @@ describe('SectionFormOperationsService test suite', () => {
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
service = TestBed.get(SectionFormOperationsService);
|
||||
service = TestBed.inject(SectionFormOperationsService);
|
||||
serviceAsAny = service;
|
||||
formBuilderService = TestBed.get(FormBuilderService);
|
||||
formBuilderService = TestBed.inject(FormBuilderService);
|
||||
});
|
||||
|
||||
describe('dispatchOperationsFromEvent', () => {
|
||||
|
@@ -220,14 +220,14 @@ describe('SubmissionSectionformComponent test suite', () => {
|
||||
fixture = TestBed.createComponent(SubmissionSectionformComponent);
|
||||
comp = fixture.componentInstance;
|
||||
compAsAny = comp;
|
||||
submissionServiceStub = TestBed.get(SubmissionService);
|
||||
sectionsServiceStub = TestBed.get(SectionsService);
|
||||
formService = TestBed.get(FormService);
|
||||
formConfigService = TestBed.get(SubmissionFormsConfigService);
|
||||
formBuilderService = TestBed.get(FormBuilderService);
|
||||
formOperationsService = TestBed.get(SectionFormOperationsService);
|
||||
translateService = TestBed.get(TranslateService);
|
||||
notificationsServiceStub = TestBed.get(NotificationsService);
|
||||
submissionServiceStub = TestBed.inject(SubmissionService as any);
|
||||
sectionsServiceStub = TestBed.inject(SectionsService as any);
|
||||
formService = TestBed.inject(FormService);
|
||||
formConfigService = TestBed.inject(SubmissionFormsConfigService);
|
||||
formBuilderService = TestBed.inject(FormBuilderService);
|
||||
formOperationsService = TestBed.inject(SectionFormOperationsService);
|
||||
translateService = TestBed.inject(TranslateService);
|
||||
notificationsServiceStub = TestBed.inject(NotificationsService as any);
|
||||
|
||||
translateService.get.and.returnValue(observableOf('test'));
|
||||
compAsAny.pathCombiner = new JsonPatchOperationPathCombiner('sections', sectionObject.id);
|
||||
|
@@ -180,12 +180,12 @@ describe('SubmissionSectionLicenseComponent test suite', () => {
|
||||
fixture = TestBed.createComponent(SubmissionSectionLicenseComponent);
|
||||
comp = fixture.componentInstance;
|
||||
compAsAny = comp;
|
||||
submissionServiceStub = TestBed.get(SubmissionService);
|
||||
sectionsServiceStub = TestBed.get(SectionsService);
|
||||
formService = TestBed.get(FormService);
|
||||
formBuilderService = TestBed.get(FormBuilderService);
|
||||
formOperationsService = TestBed.get(SectionFormOperationsService);
|
||||
collectionDataService = TestBed.get(CollectionDataService);
|
||||
submissionServiceStub = TestBed.inject(SubmissionService as any);
|
||||
sectionsServiceStub = TestBed.inject(SectionsService as any);
|
||||
formService = TestBed.inject(FormService);
|
||||
formBuilderService = TestBed.inject(FormBuilderService);
|
||||
formOperationsService = TestBed.inject(SectionFormOperationsService);
|
||||
collectionDataService = TestBed.inject(CollectionDataService);
|
||||
|
||||
compAsAny.pathCombiner = new JsonPatchOperationPathCombiner('sections', sectionObject.id);
|
||||
});
|
||||
@@ -279,7 +279,7 @@ describe('SubmissionSectionLicenseComponent test suite', () => {
|
||||
fixture.detectChanges();
|
||||
const model = formBuilderService.findById('granted', comp.formModel);
|
||||
|
||||
(model as DynamicCheckboxModel).valueUpdates.next(true);
|
||||
(model as DynamicCheckboxModel).value = true;
|
||||
|
||||
compAsAny.getSectionStatus().subscribe((status) => {
|
||||
expect(status).toBeTruthy();
|
||||
@@ -299,7 +299,7 @@ describe('SubmissionSectionLicenseComponent test suite', () => {
|
||||
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', () => {
|
||||
|
@@ -82,11 +82,11 @@ describe('SectionsService test suite', () => {
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
service = TestBed.get(SectionsService);
|
||||
submissionServiceStub = TestBed.get(SubmissionService);
|
||||
notificationsServiceStub = TestBed.get(NotificationsService);
|
||||
scrollToService = TestBed.get(ScrollToService);
|
||||
translateService = TestBed.get(TranslateService);
|
||||
service = TestBed.inject(SectionsService);
|
||||
submissionServiceStub = TestBed.inject(SubmissionService as any);
|
||||
notificationsServiceStub = TestBed.inject(NotificationsService as any);
|
||||
scrollToService = TestBed.inject(ScrollToService);
|
||||
translateService = TestBed.inject(TranslateService);
|
||||
});
|
||||
|
||||
describe('checkSectionErrors', () => {
|
||||
|
@@ -115,8 +115,8 @@ describe('SubmissionSectionUploadFileEditComponent test suite', () => {
|
||||
fixture = TestBed.createComponent(SubmissionSectionUploadFileEditComponent);
|
||||
comp = fixture.componentInstance;
|
||||
compAsAny = comp;
|
||||
submissionServiceStub = TestBed.get(SubmissionService);
|
||||
formbuilderService = TestBed.get(FormBuilderService);
|
||||
submissionServiceStub = TestBed.inject(SubmissionService as any);
|
||||
formbuilderService = TestBed.inject(FormBuilderService);
|
||||
|
||||
comp.submissionId = submissionId;
|
||||
comp.collectionId = collectionId;
|
||||
|
@@ -150,13 +150,13 @@ describe('SubmissionSectionUploadFileComponent test suite', () => {
|
||||
fixture = TestBed.createComponent(SubmissionSectionUploadFileComponent);
|
||||
comp = fixture.componentInstance;
|
||||
compAsAny = comp;
|
||||
submissionServiceStub = TestBed.get(SubmissionService);
|
||||
uploadService = TestBed.get(SectionUploadService);
|
||||
fileService = TestBed.get(FileService);
|
||||
formService = TestBed.get(FormService);
|
||||
halService = TestBed.get(HALEndpointService);
|
||||
operationsBuilder = TestBed.get(JsonPatchOperationsBuilder);
|
||||
operationsService = TestBed.get(SubmissionJsonPatchOperationsService);
|
||||
submissionServiceStub = TestBed.inject(SubmissionService as any);
|
||||
uploadService = TestBed.inject(SectionUploadService);
|
||||
fileService = TestBed.inject(FileService);
|
||||
formService = TestBed.inject(FormService);
|
||||
halService = TestBed.inject(HALEndpointService);
|
||||
operationsBuilder = TestBed.inject(JsonPatchOperationsBuilder);
|
||||
operationsService = TestBed.inject(SubmissionJsonPatchOperationsService);
|
||||
|
||||
comp.submissionId = submissionId;
|
||||
comp.collectionId = collectionId;
|
||||
@@ -237,7 +237,7 @@ describe('SubmissionSectionUploadFileComponent test suite', () => {
|
||||
}));
|
||||
|
||||
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.pathCombiner = pathCombiner;
|
||||
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(() => {
|
||||
compAsAny.fileEditComp = TestBed.get(SubmissionSectionUploadFileEditComponent);
|
||||
compAsAny.fileEditComp = TestBed.inject(SubmissionSectionUploadFileEditComponent);
|
||||
compAsAny.fileEditComp.formRef = {formGroup: null};
|
||||
compAsAny.pathCombiner = pathCombiner;
|
||||
const event = new Event('click', null);
|
||||
|
@@ -180,13 +180,13 @@ describe('SubmissionSectionUploadComponent test suite', () => {
|
||||
fixture = TestBed.createComponent(SubmissionSectionUploadComponent);
|
||||
comp = fixture.componentInstance;
|
||||
compAsAny = comp;
|
||||
submissionServiceStub = TestBed.get(SubmissionService);
|
||||
sectionsServiceStub = TestBed.get(SectionsService);
|
||||
collectionDataService = TestBed.get(CollectionDataService);
|
||||
groupService = TestBed.get(GroupDataService);
|
||||
resourcePolicyService = TestBed.get(ResourcePolicyService);
|
||||
uploadsConfigService = TestBed.get(SubmissionUploadsConfigService);
|
||||
bitstreamService = TestBed.get(SectionUploadService);
|
||||
submissionServiceStub = TestBed.inject(SubmissionService as any);
|
||||
sectionsServiceStub = TestBed.inject(SectionsService as any);
|
||||
collectionDataService = TestBed.inject(CollectionDataService);
|
||||
groupService = TestBed.inject(GroupDataService);
|
||||
resourcePolicyService = TestBed.inject(ResourcePolicyService);
|
||||
uploadsConfigService = TestBed.inject(SubmissionUploadsConfigService);
|
||||
bitstreamService = TestBed.inject(SectionUploadService);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
|
@@ -382,7 +382,7 @@ describe('SubmissionService test suite', () => {
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
service = TestBed.get(SubmissionService);
|
||||
service = TestBed.inject(SubmissionService);
|
||||
spyOn((service as any).store, 'dispatch').and.callThrough();
|
||||
});
|
||||
|
||||
|
@@ -50,8 +50,8 @@ describe('SubmissionSubmitComponent Component', () => {
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(SubmissionSubmitComponent);
|
||||
comp = fixture.componentInstance;
|
||||
submissionServiceStub = TestBed.get(SubmissionService);
|
||||
router = TestBed.get(Router);
|
||||
submissionServiceStub = TestBed.inject(SubmissionService as any);
|
||||
router = TestBed.inject(Router as any);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
|
@@ -3,6 +3,11 @@ import 'zone.js/dist/zone';
|
||||
import 'reflect-metadata';
|
||||
|
||||
import { enableProdMode } from '@angular/core';
|
||||
/******************************************************************
|
||||
* Load `$localize` - used if i18n tags appear in Angular templates.
|
||||
*/
|
||||
import '@angular/localize/init';
|
||||
|
||||
import { environment } from './environments/environment';
|
||||
|
||||
if (environment.production) {
|
||||
@@ -11,4 +16,3 @@ if (environment.production) {
|
||||
|
||||
export { ServerAppModule } from './modules/app/server-app.module';
|
||||
export { ngExpressEngine } from '@nguniversal/express-engine';
|
||||
export { provideModuleMap } from '@nguniversal/module-map-ngfactory-loader';
|
||||
|
@@ -24,9 +24,8 @@ import { SubmissionService } from '../../app/submission/submission.service';
|
||||
import { ServerSubmissionService } from '../../app/submission/server-submission.service';
|
||||
import { Angulartics2DSpace } from '../../app/statistics/angulartics/dspace-provider';
|
||||
import { Angulartics2RouterlessModule } from 'angulartics2/routerlessmodule';
|
||||
import { ModuleMapLoaderModule } from '@nguniversal/module-map-ngfactory-loader';
|
||||
import { ServerLocaleService } from 'src/app/core/locale/server-locale.service';
|
||||
import { LocaleService } from 'src/app/core/locale/locale.service';
|
||||
import { ServerLocaleService } from '../../app/core/locale/server-locale.service';
|
||||
import { LocaleService } from '../../app/core/locale/locale.service';
|
||||
import { HTTP_INTERCEPTORS } from '@angular/common/http';
|
||||
import { ForwardClientIpInterceptor } from '../../app/core/forward-client-ip/forward-client-ip.interceptor';
|
||||
import { HardRedirectService } from '../../app/core/services/hard-redirect.service';
|
||||
@@ -39,7 +38,6 @@ export function createTranslateLoader() {
|
||||
@NgModule({
|
||||
bootstrap: [AppComponent],
|
||||
imports: [
|
||||
ModuleMapLoaderModule,
|
||||
BrowserModule.withServerTransition({
|
||||
appId: 'dspace-angular'
|
||||
}),
|
||||
|
@@ -62,3 +62,8 @@ import 'core-js/features/reflect';
|
||||
import 'zone.js/dist/zone'; // Included with Angular CLI.
|
||||
|
||||
import 'reflect-metadata';
|
||||
|
||||
/******************************************************************
|
||||
* Load `$localize` - used if i18n tags appear in Angular templates.
|
||||
*/
|
||||
import '@angular/localize/init';
|
||||
|
@@ -10,7 +10,7 @@
|
||||
"src/polyfills.ts"
|
||||
],
|
||||
"include": [
|
||||
"src/**/*.ts"
|
||||
"src/**/*.d.ts"
|
||||
],
|
||||
"exclude": [
|
||||
"src/test.ts",
|
||||
|
@@ -2,7 +2,7 @@
|
||||
"extends": "./tsconfig.app.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "./out-tsc/app-server",
|
||||
"module": "commonjs",
|
||||
"module": "esnext"
|
||||
},
|
||||
"angularCompilerOptions": {
|
||||
"entryModule": "./src/modules/app/server-app.module#ServerAppModule"
|
||||
|
Reference in New Issue
Block a user