mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
Make tests compile
This commit is contained in:
@@ -32,12 +32,10 @@ import { ReloadGuard } from './core/reload/reload.guard';
|
||||
import { ServerCheckGuard } from './core/server-check/server-check.guard';
|
||||
import { ThemedForbiddenComponent } from './forbidden/themed-forbidden.component';
|
||||
import { ITEM_MODULE_PATH } from './item-page/item-page-routing-paths';
|
||||
import { MenuResolver } from './menu.resolver';
|
||||
import { ThemedPageErrorComponent } from './page-error/themed-page-error.component';
|
||||
import { ThemedPageInternalServerErrorComponent } from './page-internal-server-error/themed-page-internal-server-error.component';
|
||||
import { ThemedPageNotFoundComponent } from './pagenotfound/themed-pagenotfound.component';
|
||||
import { PROCESS_MODULE_PATH } from './process-page/process-page-routing.paths';
|
||||
import { MenuProviderService } from './shared/menu/menu-provider.service';
|
||||
import { resolveStaticMenus } from './shared/menu/menu.resolver';
|
||||
|
||||
@NgModule({
|
||||
|
@@ -4,7 +4,6 @@ import { AuthenticatedGuard } from '../core/auth/authenticated.guard';
|
||||
import { CommunityBreadcrumbResolver } from '../core/breadcrumbs/community-breadcrumb.resolver';
|
||||
import { DSOBreadcrumbsService } from '../core/breadcrumbs/dso-breadcrumbs.service';
|
||||
import { LinkService } from '../core/cache/builders/link.service';
|
||||
import { DSOEditMenuResolver } from '../shared/dso-page/dso-edit-menu.resolver';
|
||||
import { resolveRouteMenus } from '../shared/menu/menu.resolver';
|
||||
import { SubscribeMenuProvider } from '../shared/menu/providers/comcol-subscribe.menu';
|
||||
import { DSpaceObjectEditMenuProvider } from '../shared/menu/providers/dso-edit.menu';
|
||||
|
@@ -1,13 +1,10 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { RouterModule } from '@angular/router';
|
||||
import { MenuProviderService } from '../shared/menu/menu-provider.service';
|
||||
import { resolveRouteMenus } from '../shared/menu/menu.resolver';
|
||||
import { StatisticsMenuProvider } from '../shared/menu/providers/statistics.menu';
|
||||
|
||||
import { HomePageResolver } from './home-page.resolver';
|
||||
import { LinkMenuItemModel } from '../shared/menu/menu-item/models/link.model';
|
||||
import { ThemedHomePageComponent } from './themed-home-page.component';
|
||||
import { MenuItemType } from '../shared/menu/menu-item-type.model';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
|
@@ -127,17 +127,17 @@ describe('DsoEditMenuSectionComponent', () => {
|
||||
stopPropagation: jasmine.createSpy('stopPropagation'),
|
||||
});
|
||||
it('should call the item model function when not disabled', () => {
|
||||
spyOn(component.section.model as OnClickMenuItemModel, 'function');
|
||||
spyOn((component as any).section.model as OnClickMenuItemModel, 'function');
|
||||
component.activate(mockEvent);
|
||||
|
||||
expect((component.section.model as OnClickMenuItemModel).function).toHaveBeenCalled();
|
||||
expect(((component as any).section.model as OnClickMenuItemModel).function).toHaveBeenCalled();
|
||||
});
|
||||
it('should call not the item model function when disabled', () => {
|
||||
spyOn(component.section.model as OnClickMenuItemModel, 'function');
|
||||
spyOn((component as any).section.model as OnClickMenuItemModel, 'function');
|
||||
component.itemModel.disabled = true;
|
||||
component.activate(mockEvent);
|
||||
|
||||
expect((component.section.model as OnClickMenuItemModel).function).not.toHaveBeenCalled();
|
||||
expect(((component as any).section.model as OnClickMenuItemModel).function).not.toHaveBeenCalled();
|
||||
component.itemModel.disabled = false;
|
||||
});
|
||||
});
|
||||
|
@@ -10,12 +10,12 @@ import { AuthorizationDataService } from '../../../core/data/feature-authorizati
|
||||
import { AuthService } from '../../../core/auth/auth.service';
|
||||
import { AuthServiceStub } from '../../testing/auth-service.stub';
|
||||
import { MenuService } from '../../menu/menu.service';
|
||||
import { MenuItemModel } from '../../menu/menu-item/models/menu-item.model';
|
||||
import { ThemeService } from '../../theme-support/theme.service';
|
||||
import { getMockThemeService } from '../../mocks/theme-service.mock';
|
||||
|
||||
|
||||
import { DsoPageModule } from '../dso-page.module';
|
||||
import { TextMenuItemModel } from '../../menu/menu-item/models/text.model';
|
||||
|
||||
describe('DsoEditMenuComponent', () => {
|
||||
let comp: DsoEditMenuComponent;
|
||||
@@ -34,7 +34,8 @@ describe('DsoEditMenuComponent', () => {
|
||||
model: {
|
||||
type: null,
|
||||
disabled: false,
|
||||
} as MenuItemModel,
|
||||
text: 'dummy-text'
|
||||
} as TextMenuItemModel,
|
||||
icon: 'pencil-alt',
|
||||
index: 1
|
||||
};
|
||||
|
@@ -1,6 +1,5 @@
|
||||
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { Router } from '@angular/router';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import {
|
||||
ChangeDetectionStrategy,
|
||||
|
@@ -8,7 +8,6 @@ import { MenuServiceStub } from '../testing/menu-service.stub';
|
||||
import { of as observableOf } from 'rxjs';
|
||||
import { Router, ActivatedRoute } from '@angular/router';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { MenuSection } from './menu-section.model';
|
||||
import { MenuID } from './menu-id.model';
|
||||
import { Item } from '../../core/shared/item.model';
|
||||
import { AuthorizationDataService } from '../../core/data/feature-authorization/authorization-data.service';
|
||||
@@ -76,7 +75,7 @@ describe('MenuComponent', () => {
|
||||
comp.menuID = mockMenuID;
|
||||
menuService = (comp as any).menuService;
|
||||
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({}));
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
Reference in New Issue
Block a user