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('app/core/auth/account.service');
|
||||
|
||||
|
@ -19,6 +21,7 @@ describe('Component Tests', () => {
|
|||
let comp: SettingsComponent;
|
||||
let fixture: ComponentFixture<SettingsComponent>;
|
||||
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'));
|
|
@ -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;
|
||||
|
|
|
@ -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 },
|
||||
|
|
|
@ -28,7 +28,7 @@ describe('Service Tests', () => {
|
|||
elemDefault = {
|
||||
id: 0,
|
||||
nombre: 'AAAAAAA',
|
||||
iconoPerfil: 'AAAAAAA',
|
||||
iconoPerfil: 1,
|
||||
fechaNacimiento: currentDate,
|
||||
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