[CORD-1927] Fixing generate url for service models
Change-Id: I08d0d853ba2ab041626e133d079ab4562d73171e
diff --git a/src/app/datasources/helpers/model.discoverer.service.spec.ts b/src/app/datasources/helpers/model.discoverer.service.spec.ts
index 7a9e54f..8011442 100644
--- a/src/app/datasources/helpers/model.discoverer.service.spec.ts
+++ b/src/app/datasources/helpers/model.discoverer.service.spec.ts
@@ -1,4 +1,3 @@
-
/*
* Copyright 2017-present Open Networking Foundation
@@ -22,6 +21,7 @@
import {XosModelDiscovererService, IXosModelDiscovererService} from './model-discoverer.service';
import {IXosModeldef} from '../rest/modeldefs.rest';
import {BehaviorSubject} from 'rxjs';
+import {XosModeldefsCache} from './modeldefs.service';
const stubModels: IXosModeldef[] = [
{
@@ -101,7 +101,8 @@
.value('XosModelStore', MockXosModelStore)
.value('ngProgressFactory', MockngProgressFactory)
.value('XosNavigationService', MockXosNavigationService)
- .value('AuthService', {});
+ .value('AuthService', {})
+ .service('XosModeldefsCache', XosModeldefsCache);
angular.mock.module('test');
});
@@ -152,21 +153,6 @@
expect(service.getApiUrlFromModel(model)).toBe('/test/tenants');
});
- it('should retrieve a model definition from local cache', () => {
- const model = {
- name: 'Node',
- app: 'core'
- };
- service['xosModels'] = [
- model
- ];
- expect(service.get('Node')).toEqual(model);
- });
-
- it('should get the service name from the app name', () => {
- expect(service['serviceNameFromAppName']('services.vsg')).toBe('vsg');
- });
-
it('should get the state name from the model', () => {
expect(service['stateNameFromModel']({name: 'Tenant', app: 'services.vsg'})).toBe('xos.vsg.tenant');
});
@@ -276,12 +262,6 @@
);
});
- it('should store the model in memory', () => {
- service['storeModel']({name: 'Tenant'});
- expect(service['xosModels'][0]).toEqual({name: 'Tenant'});
- expect(service['xosModels'].length).toEqual(1);
- });
-
describe('when discovering models', () => {
beforeEach(() => {
spyOn(service, 'cacheModelEntries').and.callThrough();
@@ -296,7 +276,7 @@
service.discover()
.then((res) => {
expect(MockProgressBar.start).toHaveBeenCalled();
- expect(MockXosModelDefs.get).toHaveBeenCalled();
+ expect(MockXosModelDefs.get).toHaveBeenCalled(); // FIXME replace correct spy
expect(service['cacheModelEntries'].calls.count()).toBe(2);
expect(service['addState'].calls.count()).toBe(2);
expect(service['addNavItem'].calls.count()).toBe(2);