3 * ============LICENSE_START=======================================================
4 * Copyright (C) 2022 Nordix Foundation.
5 * ================================================================================
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
18 * SPDX-License-Identifier: Apache-2.0
19 * ============LICENSE_END=========================================================
22 import {async, ComponentFixture, TestBed} from '@angular/core/testing';
24 import {WorkspaceMenuComponent} from './workspace-menu.component';
25 import {CacheService} from "../../../services/cache.service";
26 import {States} from "../../../../utils/constants";
27 import {IAppMenu} from "../../../../models/app-config";
28 import {SdcMenuToken} from "../../../config/sdc-menu.config";
30 describe('WorkspaceMenuComponent', () => {
31 let component: WorkspaceMenuComponent;
32 let fixture: ComponentFixture<WorkspaceMenuComponent>;
33 let cacheService: Partial<CacheService> = {
34 'get': jest.fn(param => {
35 if (param === 'version') {
38 if (param === 'user') {
43 let sdcMenuMock: Partial<IAppMenu> = {
44 'component_workspace_menu_option': {
46 {"text": "General", "action": "onMenuItemPressed", "state": "general"}
50 let stateMock: Partial<ng.ui.IStateService> = {
52 'name': States.TYPE_WORKSPACE
55 let injectorMock: Partial<ng.auto.IInjectorService> = {
56 'get': jest.fn(param => {
57 if (param === '$state') {
63 beforeEach(async(() => {
64 TestBed.configureTestingModule({
65 declarations: [ WorkspaceMenuComponent ],
67 {provide: CacheService, useValue: cacheService},
68 {provide: '$injector', useValue: injectorMock},
69 {provide: SdcMenuToken, useValue: sdcMenuMock}
76 fixture = TestBed.createComponent(WorkspaceMenuComponent);
77 component = fixture.componentInstance;
78 fixture.detectChanges();
81 it('should create', () => {
82 expect(component).toBeTruthy();