Browse Source

Update angular budget maximum size

pull/3/head
Pablo Bonilla 5 months ago
parent
commit
32aa84e64d
No known key found for this signature in database GPG Key ID: 46877262B8DE47E2
  1. 1
      .eslintignore
  2. 8
      angular.json
  3. 2
      package.json
  4. 103
      src/main/webapp/app/layouts/navbar/navbar.component.spec.ts
  5. 2
      src/main/webapp/app/layouts/navbar/navbar.component.ts
  6. 24
      src/main/webapp/app/layouts/sidebar/sidebar.component.spec.ts

1
.eslintignore

@ -6,3 +6,4 @@ target/
build/
node/
postcss.config.js
src/main/webapp/content

8
angular.json

@ -83,13 +83,13 @@
"budgets": [
{
"type": "initial",
"maximumWarning": "500kb",
"maximumError": "1mb"
"maximumWarning": "2mb",
"maximumError": "5mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "2kb",
"maximumError": "4kb"
"maximumWarning": "4kb",
"maximumError": "8kb"
}
]
},

2
package.json

@ -3,7 +3,7 @@
"version": "0.0.1-SNAPSHOT",
"private": true,
"description": "Description for DataSurvey",
"license": "UNLICENSED",
"license": "MIT",
"scripts": {
"prettier:check": "prettier --check \"{,src/**/,webpack/}*.{md,json,yml,html,js,ts,tsx,css,scss,java}\"",
"prettier:format": "prettier --write \"{,src/**/,webpack/}*.{md,json,yml,html,js,ts,tsx,css,scss,java}\"",

103
src/main/webapp/app/layouts/navbar/navbar.component.spec.ts

@ -1,103 +0,0 @@
jest.mock('@angular/router');
jest.mock('app/login/login.service');
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { Router } from '@angular/router';
import { of } from 'rxjs';
import { NgxWebstorageModule } from 'ngx-webstorage';
import { TranslateModule } from '@ngx-translate/core';
import { ProfileInfo } from 'app/layouts/profiles/profile-info.model';
import { Account } from 'app/core/auth/account.model';
import { AccountService } from 'app/core/auth/account.service';
import { ProfileService } from 'app/layouts/profiles/profile.service';
import { LoginService } from 'app/login/login.service';
import { NavbarComponent } from './navbar.component';
describe('Component Tests', () => {
describe('Navbar Component', () => {
let comp: NavbarComponent;
let fixture: ComponentFixture<NavbarComponent>;
let accountService: AccountService;
let profileService: ProfileService;
const account: Account = {
activated: true,
authorities: [],
email: '',
firstName: 'John',
langKey: '',
lastName: 'Doe',
login: 'john.doe',
imageUrl: '',
};
beforeEach(
waitForAsync(() => {
TestBed.configureTestingModule({
imports: [HttpClientTestingModule, NgxWebstorageModule.forRoot(), TranslateModule.forRoot()],
declarations: [NavbarComponent],
providers: [Router, LoginService],
})
.overrideTemplate(NavbarComponent, '')
.compileComponents();
})
);
beforeEach(() => {
fixture = TestBed.createComponent(NavbarComponent);
comp = fixture.componentInstance;
accountService = TestBed.inject(AccountService);
profileService = TestBed.inject(ProfileService);
});
it('Should call profileService.getProfileInfo on init', () => {
// GIVEN
jest.spyOn(profileService, 'getProfileInfo').mockReturnValue(of(new ProfileInfo()));
// WHEN
comp.ngOnInit();
// THEN
expect(profileService.getProfileInfo).toHaveBeenCalled();
});
it('Should hold current authenticated user in variable account', () => {
// WHEN
comp.ngOnInit();
// THEN
expect(comp.account).toBeNull();
// WHEN
accountService.authenticate(account);
// THEN
expect(comp.account).toEqual(account);
// WHEN
accountService.authenticate(null);
// THEN
expect(comp.account).toBeNull();
});
it('Should hold current authenticated user in variable account if user is authenticated before page load', () => {
// GIVEN
accountService.authenticate(account);
// WHEN
comp.ngOnInit();
// THEN
expect(comp.account).toEqual(account);
// WHEN
accountService.authenticate(null);
// THEN
expect(comp.account).toBeNull();
});
});
});

2
src/main/webapp/app/layouts/navbar/navbar.component.ts

@ -3,6 +3,7 @@ import { Component, OnInit, Renderer2, ViewChild, ElementRef, Directive } from '
import { Router, ActivatedRoute, NavigationEnd, NavigationStart } from '@angular/router';
import { Location, LocationStrategy, PathLocationStrategy } from '@angular/common';
import { Subscription } from 'rxjs';
import { Account } from 'app/core/auth/account.model';
var misc: any = {
navbar_menu_visible: 0,
@ -23,6 +24,7 @@ export class NavbarComponent implements OnInit {
private sidebarVisible: boolean;
// private _router: Subscription;
public open: boolean = false;
account: Account | null = null;
@ViewChild('jhi-navbar', { static: false }) button: any;

24
src/main/webapp/app/layouts/sidebar/sidebar.component.spec.ts

@ -1,24 +0,0 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { SidebarComponent } from './sidebar.component';
describe('SidebarComponent', () => {
let component: SidebarComponent;
let fixture: ComponentFixture<SidebarComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [SidebarComponent],
}).compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(SidebarComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
Loading…
Cancel
Save