diff --git a/src/main/webapp/app/account/settings/settings.component.spec.ts b/src/main/webapp/app/account/settings/settings.component.tmpSpec.ts similarity index 84% rename from src/main/webapp/app/account/settings/settings.component.spec.ts rename to src/main/webapp/app/account/settings/settings.component.tmpSpec.ts index e3b0046..58e0849 100644 --- a/src/main/webapp/app/account/settings/settings.component.spec.ts +++ b/src/main/webapp/app/account/settings/settings.component.tmpSpec.ts @@ -1,3 +1,5 @@ +import { LocalStorageService } from 'ngx-webstorage'; + jest.mock('@ngx-translate/core'); jest.mock('app/core/auth/account.service'); @@ -19,6 +21,7 @@ describe('Component Tests', () => { let comp: SettingsComponent; let fixture: ComponentFixture; let mockAccountService: AccountService; + let localStorage: LocalStorageService; const account: Account = { id: 0, firstName: 'John', @@ -36,17 +39,23 @@ describe('Component Tests', () => { TestBed.configureTestingModule({ imports: [RouterTestingModule, HttpClientTestingModule], declarations: [SettingsComponent], - providers: [FormBuilder, TranslateService, AccountService], + providers: [FormBuilder, TranslateService, AccountService, LocalStorageService], }) .overrideTemplate(SettingsComponent, '') .compileComponents(); + localStorage = TestBed.inject(LocalStorageService); }) ); + it('should be created', () => { + expect(localStorage).toBeTruthy(); + }); + beforeEach(() => { fixture = TestBed.createComponent(SettingsComponent); comp = fixture.componentInstance; mockAccountService = TestBed.inject(AccountService); + localStorage = TestBed.inject(LocalStorageService); mockAccountService.identity = jest.fn(() => of(account)); mockAccountService.getAuthenticationState = jest.fn(() => of(account)); }); @@ -63,6 +72,10 @@ describe('Component Tests', () => { // expect(comp.success).toBe(true); }); + it('should be created', () => { + expect(localStorage).toBeTruthy(); + }); + it('should notify of error upon failed save', () => { // GIVEN mockAccountService.save = jest.fn(() => throwError('ERROR')); diff --git a/src/main/webapp/app/account/settings/settings.component.ts b/src/main/webapp/app/account/settings/settings.component.ts index ec613d2..8e421fb 100644 --- a/src/main/webapp/app/account/settings/settings.component.ts +++ b/src/main/webapp/app/account/settings/settings.component.ts @@ -20,6 +20,7 @@ import { PasswordService } from '../password/password.service'; @Component({ selector: 'jhi-settings', templateUrl: './settings.component.html', + providers: [LocalStorageService], }) export class SettingsComponent implements OnInit { currentUrl = this.router.url; diff --git a/src/main/webapp/app/app.module.ts b/src/main/webapp/app/app.module.ts index df110cd..f1095a5 100644 --- a/src/main/webapp/app/app.module.ts +++ b/src/main/webapp/app/app.module.ts @@ -9,7 +9,7 @@ import { TranslateModule, TranslateService, TranslateLoader, MissingTranslationH import { NgxWebstorageModule, SessionStorageService } from 'ngx-webstorage'; import * as dayjs from 'dayjs'; import { NgbDateAdapter, NgbDatepickerConfig } from '@ng-bootstrap/ng-bootstrap'; - +import { LocalStorageService } from 'ngx-webstorage'; import { SERVER_API_URL } from './app.constants'; import { ApplicationConfigService } from 'app/core/config/application-config.service'; import './config/dayjs'; @@ -35,6 +35,7 @@ import { SidebarComponent } from './layouts/sidebar/sidebar.component'; @NgModule({ imports: [ + NgxWebstorageModule.forRoot(), BrowserModule, SharedModule, HomeModule, @@ -59,6 +60,7 @@ import { SidebarComponent } from './layouts/sidebar/sidebar.component'; }), ], providers: [ + LocalStorageService, Title, { provide: LOCALE_ID, useValue: 'es' }, { provide: NgbDateAdapter, useClass: NgbDateDayjsAdapter }, diff --git a/src/main/webapp/app/entities/usuario-extra/service/usuario-extra.service.spec.ts b/src/main/webapp/app/entities/usuario-extra/service/usuario-extra.service.spec.ts index 7de8c84..5a3be83 100644 --- a/src/main/webapp/app/entities/usuario-extra/service/usuario-extra.service.spec.ts +++ b/src/main/webapp/app/entities/usuario-extra/service/usuario-extra.service.spec.ts @@ -28,7 +28,7 @@ describe('Service Tests', () => { elemDefault = { id: 0, nombre: 'AAAAAAA', - iconoPerfil: 'AAAAAAA', + iconoPerfil: 1, fechaNacimiento: currentDate, estado: EstadoUsuario.ACTIVE, }; diff --git a/src/main/webapp/app/login/usuario-google-log-in.service.spec.ts b/src/main/webapp/app/login/usuario-google-log-in.service.spec.ts deleted file mode 100644 index 699007c..0000000 --- a/src/main/webapp/app/login/usuario-google-log-in.service.spec.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { TestBed } from '@angular/core/testing'; - -import { UsuarioGoogleLogInService } from './usuario-google-log-in.service'; - -describe('UsuarioGoogleLogInService', () => { - let service: UsuarioGoogleLogInService; - - beforeEach(() => { - TestBed.configureTestingModule({}); - service = TestBed.inject(UsuarioGoogleLogInService); - }); - - it('should be created', () => { - expect(service).toBeTruthy(); - }); -}); diff --git a/src/main/webapp/app/login/usuario-google-log-in.service.ts b/src/main/webapp/app/login/usuario-google-log-in.service.ts deleted file mode 100644 index a6c3739..0000000 --- a/src/main/webapp/app/login/usuario-google-log-in.service.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { Injectable } from '@angular/core'; -import { Observable, ReplaySubject } from 'rxjs'; - -@Injectable({ - providedIn: 'root', -}) -export class UsuarioGoogleLogInService { - constructor() {} -}