areglos archivos test
This commit is contained in:
parent
f349ee6020
commit
3f61d3ab4b
|
@ -1,3 +1,5 @@
|
||||||
|
import { LocalStorageService } from 'ngx-webstorage';
|
||||||
|
|
||||||
jest.mock('@ngx-translate/core');
|
jest.mock('@ngx-translate/core');
|
||||||
jest.mock('app/core/auth/account.service');
|
jest.mock('app/core/auth/account.service');
|
||||||
|
|
||||||
|
@ -19,6 +21,7 @@ describe('Component Tests', () => {
|
||||||
let comp: SettingsComponent;
|
let comp: SettingsComponent;
|
||||||
let fixture: ComponentFixture<SettingsComponent>;
|
let fixture: ComponentFixture<SettingsComponent>;
|
||||||
let mockAccountService: AccountService;
|
let mockAccountService: AccountService;
|
||||||
|
let localStorage: LocalStorageService;
|
||||||
const account: Account = {
|
const account: Account = {
|
||||||
id: 0,
|
id: 0,
|
||||||
firstName: 'John',
|
firstName: 'John',
|
||||||
|
@ -36,17 +39,23 @@ describe('Component Tests', () => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [RouterTestingModule, HttpClientTestingModule],
|
imports: [RouterTestingModule, HttpClientTestingModule],
|
||||||
declarations: [SettingsComponent],
|
declarations: [SettingsComponent],
|
||||||
providers: [FormBuilder, TranslateService, AccountService],
|
providers: [FormBuilder, TranslateService, AccountService, LocalStorageService],
|
||||||
})
|
})
|
||||||
.overrideTemplate(SettingsComponent, '')
|
.overrideTemplate(SettingsComponent, '')
|
||||||
.compileComponents();
|
.compileComponents();
|
||||||
|
localStorage = TestBed.inject(LocalStorageService);
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
it('should be created', () => {
|
||||||
|
expect(localStorage).toBeTruthy();
|
||||||
|
});
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
fixture = TestBed.createComponent(SettingsComponent);
|
fixture = TestBed.createComponent(SettingsComponent);
|
||||||
comp = fixture.componentInstance;
|
comp = fixture.componentInstance;
|
||||||
mockAccountService = TestBed.inject(AccountService);
|
mockAccountService = TestBed.inject(AccountService);
|
||||||
|
localStorage = TestBed.inject(LocalStorageService);
|
||||||
mockAccountService.identity = jest.fn(() => of(account));
|
mockAccountService.identity = jest.fn(() => of(account));
|
||||||
mockAccountService.getAuthenticationState = jest.fn(() => of(account));
|
mockAccountService.getAuthenticationState = jest.fn(() => of(account));
|
||||||
});
|
});
|
||||||
|
@ -63,6 +72,10 @@ describe('Component Tests', () => {
|
||||||
// expect(comp.success).toBe(true);
|
// expect(comp.success).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should be created', () => {
|
||||||
|
expect(localStorage).toBeTruthy();
|
||||||
|
});
|
||||||
|
|
||||||
it('should notify of error upon failed save', () => {
|
it('should notify of error upon failed save', () => {
|
||||||
// GIVEN
|
// GIVEN
|
||||||
mockAccountService.save = jest.fn(() => throwError('ERROR'));
|
mockAccountService.save = jest.fn(() => throwError('ERROR'));
|
|
@ -20,6 +20,7 @@ import { PasswordService } from '../password/password.service';
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'jhi-settings',
|
selector: 'jhi-settings',
|
||||||
templateUrl: './settings.component.html',
|
templateUrl: './settings.component.html',
|
||||||
|
providers: [LocalStorageService],
|
||||||
})
|
})
|
||||||
export class SettingsComponent implements OnInit {
|
export class SettingsComponent implements OnInit {
|
||||||
currentUrl = this.router.url;
|
currentUrl = this.router.url;
|
||||||
|
|
|
@ -9,7 +9,7 @@ import { TranslateModule, TranslateService, TranslateLoader, MissingTranslationH
|
||||||
import { NgxWebstorageModule, SessionStorageService } from 'ngx-webstorage';
|
import { NgxWebstorageModule, SessionStorageService } from 'ngx-webstorage';
|
||||||
import * as dayjs from 'dayjs';
|
import * as dayjs from 'dayjs';
|
||||||
import { NgbDateAdapter, NgbDatepickerConfig } from '@ng-bootstrap/ng-bootstrap';
|
import { NgbDateAdapter, NgbDatepickerConfig } from '@ng-bootstrap/ng-bootstrap';
|
||||||
|
import { LocalStorageService } from 'ngx-webstorage';
|
||||||
import { SERVER_API_URL } from './app.constants';
|
import { SERVER_API_URL } from './app.constants';
|
||||||
import { ApplicationConfigService } from 'app/core/config/application-config.service';
|
import { ApplicationConfigService } from 'app/core/config/application-config.service';
|
||||||
import './config/dayjs';
|
import './config/dayjs';
|
||||||
|
@ -35,6 +35,7 @@ import { SidebarComponent } from './layouts/sidebar/sidebar.component';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
|
NgxWebstorageModule.forRoot(),
|
||||||
BrowserModule,
|
BrowserModule,
|
||||||
SharedModule,
|
SharedModule,
|
||||||
HomeModule,
|
HomeModule,
|
||||||
|
@ -59,6 +60,7 @@ import { SidebarComponent } from './layouts/sidebar/sidebar.component';
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
|
LocalStorageService,
|
||||||
Title,
|
Title,
|
||||||
{ provide: LOCALE_ID, useValue: 'es' },
|
{ provide: LOCALE_ID, useValue: 'es' },
|
||||||
{ provide: NgbDateAdapter, useClass: NgbDateDayjsAdapter },
|
{ provide: NgbDateAdapter, useClass: NgbDateDayjsAdapter },
|
||||||
|
|
|
@ -28,7 +28,7 @@ describe('Service Tests', () => {
|
||||||
elemDefault = {
|
elemDefault = {
|
||||||
id: 0,
|
id: 0,
|
||||||
nombre: 'AAAAAAA',
|
nombre: 'AAAAAAA',
|
||||||
iconoPerfil: 'AAAAAAA',
|
iconoPerfil: 1,
|
||||||
fechaNacimiento: currentDate,
|
fechaNacimiento: currentDate,
|
||||||
estado: EstadoUsuario.ACTIVE,
|
estado: EstadoUsuario.ACTIVE,
|
||||||
};
|
};
|
||||||
|
|
|
@ -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();
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -1,9 +0,0 @@
|
||||||
import { Injectable } from '@angular/core';
|
|
||||||
import { Observable, ReplaySubject } from 'rxjs';
|
|
||||||
|
|
||||||
@Injectable({
|
|
||||||
providedIn: 'root',
|
|
||||||
})
|
|
||||||
export class UsuarioGoogleLogInService {
|
|
||||||
constructor() {}
|
|
||||||
}
|
|
Loading…
Reference in New Issue