diff --git a/src/app/core/services/helpers/config.helpers.spec.ts b/src/app/core/services/helpers/config.helpers.spec.ts
index ed41228..d060001 100644
--- a/src/app/core/services/helpers/config.helpers.spec.ts
+++ b/src/app/core/services/helpers/config.helpers.spec.ts
@@ -267,7 +267,7 @@
         test: 2
       };
       it('should add the formatted data to the column definition', () => {
-        service = new ConfigHelpers(stateMock, toastr, auth, modelStoreMock);
+        service = new ConfigHelpers(stateMock, toastr, modelStoreMock);
         service['populateRelated'](item, item.test, field);
         expect(item['test-formatted']).toBe('second');
       });
@@ -283,7 +283,7 @@
       };
 
       it('should add the available choice to the select', () => {
-        service = new ConfigHelpers(stateMock, toastr, auth, modelStoreMock);
+        service = new ConfigHelpers(stateMock, toastr, modelStoreMock);
         service['populateSelectField'](field, input);
         expect(input.options).toEqual([
           {id: 1, label: 'test'},
diff --git a/src/app/core/services/helpers/config.helpers.ts b/src/app/core/services/helpers/config.helpers.ts
index 241d380..1cd9e60 100644
--- a/src/app/core/services/helpers/config.helpers.ts
+++ b/src/app/core/services/helpers/config.helpers.ts
@@ -3,7 +3,6 @@
 import {IXosTableColumn, IXosTableCfg} from '../../table/table';
 import {IXosModeldef} from '../../../datasources/rest/modeldefs.rest';
 import {IXosFormCfg, IXosFormInput, IXosFormInputValidator} from '../../form/form';
-import {IXosAuthService} from '../../../datasources/rest/auth.rest';
 import {IXosModelStoreService} from '../../../datasources/stores/model.store';
 import {IXosState} from '../runtime-states';
 
@@ -42,7 +41,6 @@
   static $inject = [
     '$state',
     'toastr',
-    'AuthService',
     'XosModelStore'];
 
   public excluded_fields = [
@@ -67,7 +65,6 @@
   constructor(
     private $state: ng.ui.IStateService,
     private toastr: ng.toastr.IToastrService,
-    private AuthService: IXosAuthService,
     private XosModelStore: IXosModelStoreService
   ) {
     pluralize.addIrregularRule('xos', 'xoses');
@@ -263,9 +260,6 @@
       // TODO remove ManyToMany relations and save them separately (how??)
       delete item.networks;
 
-      // adding userId as creator
-      // item.creator = this.AuthService.getUser().id;
-
       // remove field added by xosTable
       _.forEach(Object.keys(item), prop => {
         if (prop.indexOf('-formatted') > -1) {
diff --git a/src/app/datasources/helpers/model-discoverer.service.ts b/src/app/datasources/helpers/model-discoverer.service.ts
index ba9cb13..4306825 100644
--- a/src/app/datasources/helpers/model-discoverer.service.ts
+++ b/src/app/datasources/helpers/model-discoverer.service.ts
@@ -106,7 +106,7 @@
               return this.$q.resolve('true');
             })
             .catch(err => {
-              this.$log.error(`[XosModelDiscovererService] Model ${model.name} NOT stored`);
+              this.$log.error(`[XosModelDiscovererService] Model ${model.name} NOT stored`, err);
               return this.$q.resolve('false');
             });
             pArray.push(p);
@@ -116,11 +116,12 @@
             // the Model Loader promise won't ever be reject, in case it will be resolve with value false,
             // that's because we want to wait anyway for all the models to be loaded
             if (res.indexOf('false') > -1) {
-              d.resolve(false);
+              return d.resolve(false);
             }
             d.resolve(true);
           })
-          .catch(() => {
+          .catch((e) => {
+            this.$log.error(`[XosModelDiscovererService]`, e);
             d.resolve(false);
           })
           .finally(() => {
diff --git a/src/app/datasources/helpers/model.discoverer.service.spec.ts b/src/app/datasources/helpers/model.discoverer.service.spec.ts
new file mode 100644
index 0000000..8b17f34
--- /dev/null
+++ b/src/app/datasources/helpers/model.discoverer.service.spec.ts
@@ -0,0 +1,254 @@
+import * as angular from 'angular';
+import 'angular-mocks';
+import 'angular-ui-router';
+import {XosModelDiscovererService, IXosModelDiscovererService} from './model-discoverer.service';
+import {IXosModeldef} from '../rest/modeldefs.rest';
+import {BehaviorSubject} from 'rxjs';
+
+const stubModels: IXosModeldef[] = [
+  {
+    fields: [
+      {name: 'id', type: 'number'},
+      {name: 'foo', type: 'string'}
+    ],
+    relations: [],
+    name: 'Node',
+    app: 'core'
+  },
+  {
+    fields: [
+      {name: 'id', type: 'number'},
+      {name: 'bar', type: 'string'}
+    ],
+    relations: [],
+    name: 'VSGTenant',
+    app: 'service.vsg'
+  }
+];
+
+let service: IXosModelDiscovererService;
+let scope: ng.IScope;
+const MockXosModelDefs = {
+  get: null
+};
+let MockXosRuntimeStates = {
+  addState: jasmine.createSpy('runtimeState.addState')
+    .and.callFake(() => true)
+};
+let MockConfigHelpers = {
+  pluralize: jasmine.createSpy('config.pluralize')
+    .and.callFake((string: string) => `${string}s`),
+  toLabel: jasmine.createSpy('config.toLabel')
+    .and.callFake((string: string) => string.toLowerCase()),
+  modelToTableCfg: jasmine.createSpy('config.modelToTableCfg')
+    .and.callFake(() => true),
+  modelToFormCfg: jasmine.createSpy('config.modelToFormCfg')
+    .and.callFake(() => true),
+};
+let MockXosNavigationService = {
+  add: jasmine.createSpy('navigationService.add')
+    .and.callFake(() => true)
+};
+const MockXosModelStore = {
+  query: jasmine.createSpy('modelStore.query')
+    .and.callFake(() => {
+      const list = new BehaviorSubject([]);
+      list.next([]);
+      return list.asObservable();
+    })
+};
+const MockProgressBar = {
+  setColor: jasmine.createSpy('progressBar.setColor'),
+  start: jasmine.createSpy('progressBar.start'),
+  complete: jasmine.createSpy('progressBar.complete')
+};
+const MockngProgressFactory = {
+  createInstance: jasmine.createSpy('ngProgress.createInstance')
+    .and.callFake(() => MockProgressBar)
+};
+
+describe('The ModelDicoverer service', () => {
+
+  beforeEach(() => {
+    angular
+      .module('test', [])
+      .service('XosModelDiscoverer', XosModelDiscovererService)
+      .value('ConfigHelpers', MockConfigHelpers)
+      .value('XosModelDefs', MockXosModelDefs)
+      .value('XosRuntimeStates', MockXosRuntimeStates)
+      .value('XosModelStore', MockXosModelStore)
+      .value('ngProgressFactory', MockngProgressFactory)
+      .value('XosNavigationService', MockXosNavigationService);
+
+    angular.mock.module('test');
+  });
+
+  beforeEach(angular.mock.inject((
+    XosModelDiscoverer: IXosModelDiscovererService,
+    $rootScope: ng.IScope,
+    $q: ng.IQService
+  ) => {
+    service = XosModelDiscoverer;
+    scope = $rootScope;
+    MockXosModelDefs.get = jasmine.createSpy('modelDefs.get')
+      .and.callFake(() => {
+        const d = $q.defer();
+        d.resolve(stubModels);
+        return d.promise;
+      });
+  }));
+
+  it('should setup the progress bar', () => {
+    expect(MockngProgressFactory.createInstance).toHaveBeenCalled();
+    expect(MockProgressBar.setColor).toHaveBeenCalled();
+  });
+
+  it('should not have loaded models', () => {
+    expect(service.areModelsLoaded()).toBeFalsy();
+  });
+
+  it('should get the url from a core model', () => {
+    const model = {
+      name: 'Node',
+      app: 'core',
+      fields: []
+    };
+    expect(service.getApiUrlFromModel(model)).toBe('/core/nodes');
+  });
+
+  it('should get the url from a service model', () => {
+    const model = {
+      name: 'Tenant',
+      app: 'services.test',
+      fields: []
+    };
+    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');
+  });
+
+  it('should get the parent state name from a core model', () => {
+    expect(service['getParentStateFromModel']({name: 'Nodes', app: 'core'})).toBe('xos.core');
+  });
+
+  it('should get the parent state name from a service model', () => {
+    expect(service['getParentStateFromModel']({name: 'Tenant', app: 'services.vsg'})).toBe('xos.vsg');
+  });
+
+  it('should add a new service entry in the system', () => {
+    service['addService']({name: 'Tenant', app: 'services.vsg'});
+    expect(MockXosRuntimeStates.addState).toHaveBeenCalledWith('xos.vsg', {
+      url: 'vsg',
+      parent: 'xos',
+      abstract: true,
+      template: '<div ui-view></div>'
+    });
+    expect(MockXosNavigationService.add).toHaveBeenCalledWith({
+      label: 'vsg',
+      state: 'xos.vsg'
+    });
+    expect(service['xosServices'][0]).toEqual('vsg');
+    expect(service['xosServices'].length).toBe(1);
+  });
+
+  it('should add a state in the system', (done) => {
+    MockXosRuntimeStates.addState.calls.reset();
+    service['addState']({name: 'Tenant', app: 'services.vsg'})
+      .then((model) => {
+        expect(MockXosRuntimeStates.addState).toHaveBeenCalledWith('xos.vsg.tenant', {
+          parent: 'xos.vsg',
+          url: '/tenants/:id?',
+          params: {
+            id: null
+          },
+          data: {
+            model: 'Tenant'
+          },
+          component: 'xosCrud',
+        });
+        expect(model.clientUrl).toBe('vsg/tenants/:id?');
+        done();
+      });
+    scope.$apply();
+  });
+
+  it('should add an item to navigation', () => {
+    service['addNavItem']({name: 'Tenant', app: 'services.vsg'});
+    expect(MockXosNavigationService.add).toHaveBeenCalledWith({
+      label: 'Tenants',
+      state: 'xos.vsg.tenant',
+      parent: 'xos.vsg'
+    });
+  });
+
+  it('should cache a model', () => {
+    service['cacheModelEntries']({name: 'Tenant', app: 'services.vsg'});
+    expect(MockXosModelStore.query).toHaveBeenCalledWith('Tenant', '/vsg/tenants');
+  });
+
+  it('should get the table config', () => {
+    service['getTableCfg']({name: 'Tenant', app: 'services.vsg'});
+    expect(MockConfigHelpers.modelToTableCfg).toHaveBeenCalledWith(
+      {name: 'Tenant', app: 'services.vsg', tableCfg: true},
+      'xos.vsg.tenant'
+    );
+  });
+
+  it('should get the form config', () => {
+    service['getFormCfg']({name: 'Tenant', app: 'services.vsg'});
+    expect(MockConfigHelpers.modelToFormCfg).toHaveBeenCalledWith(
+      {name: 'Tenant', app: 'services.vsg', formCfg: true}
+    );
+  });
+
+  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();
+      spyOn(service, 'addState').and.callThrough();
+      spyOn(service, 'addNavItem').and.callThrough();
+      spyOn(service, 'getTableCfg').and.callThrough();
+      spyOn(service, 'getFormCfg').and.callThrough();
+      spyOn(service, 'storeModel').and.callThrough();
+    });
+
+    it('should call all the function chain', (done) => {
+      service.discover()
+        .then((res) => {
+          expect(MockProgressBar.start).toHaveBeenCalled();
+          expect(MockXosModelDefs.get).toHaveBeenCalled();
+          expect(service['cacheModelEntries'].calls.count()).toBe(2);
+          expect(service['addState'].calls.count()).toBe(2);
+          expect(service['addNavItem'].calls.count()).toBe(2);
+          expect(service['getTableCfg'].calls.count()).toBe(2);
+          expect(service['getFormCfg'].calls.count()).toBe(2);
+          expect(service['storeModel'].calls.count()).toBe(2);
+          expect(res).toBeTruthy();
+          done();
+        });
+      scope.$apply();
+    });
+  });
+});
