From 3a61ab32ae41b8ebad6ffc541521340ccd0c13a8 Mon Sep 17 00:00:00 2001 From: Manuel <5877862+manuelsc@users.noreply.github.com> Date: Mon, 3 Feb 2025 10:53:37 +0100 Subject: [PATCH] misc: prettier format --- .../dashboard/dashboard.component.scss | 1 - .../group-selector.component.spec.ts | 33 +++++++++-------- .../group-selector.component.ts | 10 +++--- .../validator/validator.component.html | 2 +- .../validator/validator.component.scss | 10 +++--- .../validator/validator.component.ts | 2 +- .../accordion-indexslot.component.spec.ts | 33 +++++++++-------- .../more/more.component.spec.ts | 33 +++++++++-------- .../notification-detail.component.spec.ts | 33 +++++++++-------- .../base-history-item.component.spec.ts | 33 +++++++++-------- .../client-history-item.component.spec.ts | 33 +++++++++-------- .../machine-history-item.component.spec.ts | 33 +++++++++-------- .../network-history-item.component.spec.ts | 33 +++++++++-------- src/app/requests/types/search.ts | 36 +++++++++++-------- src/app/requests/v2-search.ts | 19 +++++++--- src/app/services/api.spec.ts | 30 ++++++++-------- .../tab-dashboard/tab-dashboard.page.scss | 14 ++++---- .../tab-validators/tab-validators.page.html | 4 +-- src/app/utils/Formatting.ts | 20 +++++------ src/test.ts | 19 +++++----- 20 files changed, 217 insertions(+), 214 deletions(-) diff --git a/src/app/components/dashboard/dashboard.component.scss b/src/app/components/dashboard/dashboard.component.scss index 5c9c265f..6d4b986b 100644 --- a/src/app/components/dashboard/dashboard.component.scss +++ b/src/app/components/dashboard/dashboard.component.scss @@ -165,4 +165,3 @@ ion-item { ion-item ion-label { margin-right: 0px; // fixes ios margin at the right side } - diff --git a/src/app/components/dashboard/group-selector/group-selector.component.spec.ts b/src/app/components/dashboard/group-selector/group-selector.component.spec.ts index e1ed5046..db5d8c76 100644 --- a/src/app/components/dashboard/group-selector/group-selector.component.spec.ts +++ b/src/app/components/dashboard/group-selector/group-selector.component.spec.ts @@ -1,23 +1,22 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed } from '@angular/core/testing' -import { GroupSelectorComponent } from './group-selector.component'; +import { GroupSelectorComponent } from './group-selector.component' describe('GroupSelectorComponent', () => { - let component: GroupSelectorComponent; - let fixture: ComponentFixture; + let component: GroupSelectorComponent + let fixture: ComponentFixture - beforeEach(async () => { - await TestBed.configureTestingModule({ - imports: [GroupSelectorComponent] - }) - .compileComponents(); + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [GroupSelectorComponent], + }).compileComponents() - fixture = TestBed.createComponent(GroupSelectorComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + fixture = TestBed.createComponent(GroupSelectorComponent) + component = fixture.componentInstance + fixture.detectChanges() + }) - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); + it('should create', () => { + expect(component).toBeTruthy() + }) +}) diff --git a/src/app/components/dashboard/group-selector/group-selector.component.ts b/src/app/components/dashboard/group-selector/group-selector.component.ts index 4d2b0288..11569b94 100644 --- a/src/app/components/dashboard/group-selector/group-selector.component.ts +++ b/src/app/components/dashboard/group-selector/group-selector.component.ts @@ -1,7 +1,7 @@ -import { CommonModule } from '@angular/common'; -import { Component, EventEmitter, Input, Output } from '@angular/core'; -import { IonicModule } from '@ionic/angular'; -import { GroupEntries } from '@utils/DashboardUtils'; +import { CommonModule } from '@angular/common' +import { Component, EventEmitter, Input, Output } from '@angular/core' +import { IonicModule } from '@ionic/angular' +import { GroupEntries } from '@utils/DashboardUtils' @Component({ selector: 'app-group-selector', @@ -17,7 +17,7 @@ export class GroupSelectorComponent { @Output() groupChanged = new EventEmitter() selectGroup(event: CustomEvent<{ value: number }>): void { - const selectedGroupID = event.detail.value + const selectedGroupID = event.detail.value this.groupChanged.emit(selectedGroupID) } } diff --git a/src/app/components/validator/validator.component.html b/src/app/components/validator/validator.component.html index 73a6ae0d..feb6f611 100644 --- a/src/app/components/validator/validator.component.html +++ b/src/app/components/validator/validator.component.html @@ -31,7 +31,7 @@
- {{ name }} + {{ name }}
diff --git a/src/app/components/validator/validator.component.scss b/src/app/components/validator/validator.component.scss index 0cbc0dbe..6a64e1d0 100644 --- a/src/app/components/validator/validator.component.scss +++ b/src/app/components/validator/validator.component.scss @@ -28,8 +28,6 @@ ion-item { margin: auto; } - - .balance { font-weight: bold; } @@ -102,7 +100,7 @@ ion-badge { } .labels { - font-size: 0.65rem; + font-size: 0.65rem; vertical-align: top; margin-right: 3px; } @@ -111,7 +109,7 @@ ion-icon { font-size: 0.65rem; color: var(--ion-color-sync-icon-small); position: absolute; - top: 3px; + top: 3px; } .sync-active { @@ -122,5 +120,5 @@ ion-icon { .sync-container { height: 14px; - display: inline-block; -} \ No newline at end of file + display: inline-block; +} diff --git a/src/app/components/validator/validator.component.ts b/src/app/components/validator/validator.component.ts index 9cbbae71..7637ea0b 100644 --- a/src/app/components/validator/validator.component.ts +++ b/src/app/components/validator/validator.component.ts @@ -23,7 +23,7 @@ import { getDisplayName, ValidatorState } from 'src/app/utils/ValidatorUtils' import { UnitconvService } from '@services/unitconv.service' import { MobileValidatorDashboardValidatorsTableRow } from '@requests/types/mobile' -type SyncState = 'none' | 'current' | 'next' +type SyncState = 'none' | 'current' | 'next' @Component({ selector: 'app-validator', templateUrl: './validator.component.html', diff --git a/src/app/pages/notification-detail/accordion-indexslot/accordion-indexslot.component.spec.ts b/src/app/pages/notification-detail/accordion-indexslot/accordion-indexslot.component.spec.ts index b9c3195b..5cd47212 100644 --- a/src/app/pages/notification-detail/accordion-indexslot/accordion-indexslot.component.spec.ts +++ b/src/app/pages/notification-detail/accordion-indexslot/accordion-indexslot.component.spec.ts @@ -1,23 +1,22 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed } from '@angular/core/testing' -import { AccordionIndexslotComponent } from './accordion-indexslot.component'; +import { AccordionIndexslotComponent } from './accordion-indexslot.component' describe('AccordionIndexslotComponent', () => { - let component: AccordionIndexslotComponent; - let fixture: ComponentFixture; + let component: AccordionIndexslotComponent + let fixture: ComponentFixture - beforeEach(async () => { - await TestBed.configureTestingModule({ - imports: [AccordionIndexslotComponent] - }) - .compileComponents(); + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [AccordionIndexslotComponent], + }).compileComponents() - fixture = TestBed.createComponent(AccordionIndexslotComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + fixture = TestBed.createComponent(AccordionIndexslotComponent) + component = fixture.componentInstance + fixture.detectChanges() + }) - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); + it('should create', () => { + expect(component).toBeTruthy() + }) +}) diff --git a/src/app/pages/notification-detail/more/more.component.spec.ts b/src/app/pages/notification-detail/more/more.component.spec.ts index 790bfe42..66f26514 100644 --- a/src/app/pages/notification-detail/more/more.component.spec.ts +++ b/src/app/pages/notification-detail/more/more.component.spec.ts @@ -1,23 +1,22 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed } from '@angular/core/testing' -import { MoreComponent } from './more.component'; +import { MoreComponent } from './more.component' describe('MoreComponent', () => { - let component: MoreComponent; - let fixture: ComponentFixture; + let component: MoreComponent + let fixture: ComponentFixture - beforeEach(async () => { - await TestBed.configureTestingModule({ - imports: [MoreComponent] - }) - .compileComponents(); + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [MoreComponent], + }).compileComponents() - fixture = TestBed.createComponent(MoreComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + fixture = TestBed.createComponent(MoreComponent) + component = fixture.componentInstance + fixture.detectChanges() + }) - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); + it('should create', () => { + expect(component).toBeTruthy() + }) +}) diff --git a/src/app/pages/notification-detail/notification-detail.component.spec.ts b/src/app/pages/notification-detail/notification-detail.component.spec.ts index 2a8873af..658e4c13 100644 --- a/src/app/pages/notification-detail/notification-detail.component.spec.ts +++ b/src/app/pages/notification-detail/notification-detail.component.spec.ts @@ -1,23 +1,22 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed } from '@angular/core/testing' -import { NotificationDetailComponent } from './notification-detail.component'; +import { NotificationDetailComponent } from './notification-detail.component' describe('NotificationDetailComponent', () => { - let component: NotificationDetailComponent; - let fixture: ComponentFixture; + let component: NotificationDetailComponent + let fixture: ComponentFixture - beforeEach(async () => { - await TestBed.configureTestingModule({ - imports: [NotificationDetailComponent] - }) - .compileComponents(); + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [NotificationDetailComponent], + }).compileComponents() - fixture = TestBed.createComponent(NotificationDetailComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + fixture = TestBed.createComponent(NotificationDetailComponent) + component = fixture.componentInstance + fixture.detectChanges() + }) - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); + it('should create', () => { + expect(component).toBeTruthy() + }) +}) diff --git a/src/app/pages/notification-history/base-history-item/base-history-item.component.spec.ts b/src/app/pages/notification-history/base-history-item/base-history-item.component.spec.ts index 8f79d612..dddd8d67 100644 --- a/src/app/pages/notification-history/base-history-item/base-history-item.component.spec.ts +++ b/src/app/pages/notification-history/base-history-item/base-history-item.component.spec.ts @@ -1,23 +1,22 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed } from '@angular/core/testing' -import { BaseHistoryItemComponent } from './base-history-item.component'; +import { BaseHistoryItemComponent } from './base-history-item.component' describe('BaseHistoryItemComponent', () => { - let component: BaseHistoryItemComponent; - let fixture: ComponentFixture; + let component: BaseHistoryItemComponent + let fixture: ComponentFixture - beforeEach(async () => { - await TestBed.configureTestingModule({ - imports: [BaseHistoryItemComponent] - }) - .compileComponents(); + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [BaseHistoryItemComponent], + }).compileComponents() - fixture = TestBed.createComponent(BaseHistoryItemComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + fixture = TestBed.createComponent(BaseHistoryItemComponent) + component = fixture.componentInstance + fixture.detectChanges() + }) - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); + it('should create', () => { + expect(component).toBeTruthy() + }) +}) diff --git a/src/app/pages/notification-history/client-history-item/client-history-item.component.spec.ts b/src/app/pages/notification-history/client-history-item/client-history-item.component.spec.ts index 09ea8567..77f06049 100644 --- a/src/app/pages/notification-history/client-history-item/client-history-item.component.spec.ts +++ b/src/app/pages/notification-history/client-history-item/client-history-item.component.spec.ts @@ -1,23 +1,22 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed } from '@angular/core/testing' -import { ClientHistoryItemComponent } from './client-history-item.component'; +import { ClientHistoryItemComponent } from './client-history-item.component' describe('ClientHistoryItemComponent', () => { - let component: ClientHistoryItemComponent; - let fixture: ComponentFixture; + let component: ClientHistoryItemComponent + let fixture: ComponentFixture - beforeEach(async () => { - await TestBed.configureTestingModule({ - imports: [ClientHistoryItemComponent] - }) - .compileComponents(); + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [ClientHistoryItemComponent], + }).compileComponents() - fixture = TestBed.createComponent(ClientHistoryItemComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + fixture = TestBed.createComponent(ClientHistoryItemComponent) + component = fixture.componentInstance + fixture.detectChanges() + }) - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); + it('should create', () => { + expect(component).toBeTruthy() + }) +}) diff --git a/src/app/pages/notification-history/machine-history-item/machine-history-item.component.spec.ts b/src/app/pages/notification-history/machine-history-item/machine-history-item.component.spec.ts index 095b3ed6..53fe6fc1 100644 --- a/src/app/pages/notification-history/machine-history-item/machine-history-item.component.spec.ts +++ b/src/app/pages/notification-history/machine-history-item/machine-history-item.component.spec.ts @@ -1,23 +1,22 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed } from '@angular/core/testing' -import { MachineHistoryItemComponent } from './machine-history-item.component'; +import { MachineHistoryItemComponent } from './machine-history-item.component' describe('MachineHistoryItemComponent', () => { - let component: MachineHistoryItemComponent; - let fixture: ComponentFixture; + let component: MachineHistoryItemComponent + let fixture: ComponentFixture - beforeEach(async () => { - await TestBed.configureTestingModule({ - imports: [MachineHistoryItemComponent] - }) - .compileComponents(); + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [MachineHistoryItemComponent], + }).compileComponents() - fixture = TestBed.createComponent(MachineHistoryItemComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + fixture = TestBed.createComponent(MachineHistoryItemComponent) + component = fixture.componentInstance + fixture.detectChanges() + }) - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); + it('should create', () => { + expect(component).toBeTruthy() + }) +}) diff --git a/src/app/pages/notification-history/network-history-item/network-history-item.component.spec.ts b/src/app/pages/notification-history/network-history-item/network-history-item.component.spec.ts index f8e985b6..2425bfa0 100644 --- a/src/app/pages/notification-history/network-history-item/network-history-item.component.spec.ts +++ b/src/app/pages/notification-history/network-history-item/network-history-item.component.spec.ts @@ -1,23 +1,22 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed } from '@angular/core/testing' -import { NetworkHistoryItemComponent } from './network-history-item.component'; +import { NetworkHistoryItemComponent } from './network-history-item.component' describe('NetworkHistoryItemComponent', () => { - let component: NetworkHistoryItemComponent; - let fixture: ComponentFixture; + let component: NetworkHistoryItemComponent + let fixture: ComponentFixture - beforeEach(async () => { - await TestBed.configureTestingModule({ - imports: [NetworkHistoryItemComponent] - }) - .compileComponents(); + beforeEach(async () => { + await TestBed.configureTestingModule({ + imports: [NetworkHistoryItemComponent], + }).compileComponents() - fixture = TestBed.createComponent(NetworkHistoryItemComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); + fixture = TestBed.createComponent(NetworkHistoryItemComponent) + component = fixture.componentInstance + fixture.detectChanges() + }) - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); + it('should create', () => { + expect(component).toBeTruthy() + }) +}) diff --git a/src/app/requests/types/search.ts b/src/app/requests/types/search.ts index e5f2eb87..0518b0a6 100644 --- a/src/app/requests/types/search.ts +++ b/src/app/requests/types/search.ts @@ -5,31 +5,37 @@ // source: search.go export interface SearchValidator { - index: number /* uint64 */; - public_key: string; + index: number /* uint64 */ + public_key: string } export interface SearchValidatorList { - validators: number /* uint64 */[]; + validators: number /* uint64 */[] } export interface SearchValidatorsByDepositAddress { - ens_name?: string; - deposit_address: string; - count: number /* uint64 */; + ens_name?: string + deposit_address: string + count: number /* uint64 */ } export interface SearchValidatorsByWithdrwalCredential { - ens_name?: string; - withdrawal_credential: string; - count: number /* uint64 */; + ens_name?: string + withdrawal_credential: string + count: number /* uint64 */ } export interface SearchValidatorsByGraffiti { - graffiti: string; - count: number /* uint64 */; + graffiti: string + count: number /* uint64 */ } export interface SearchResult { - type: string; - chain_id: number /* uint64 */; - value: any; + type: string + chain_id: number /* uint64 */ + value: any } export interface InternalPostSearchResponse { - data: ({ type: 'validator'; chain_id: number; value: SearchValidator } | { type: 'validator_list'; chain_id: number; value: SearchValidatorList } | { type: 'validators_by_deposit_address'; chain_id: number; value: SearchValidatorsByDepositAddress } | { type: 'validators_by_withdrawal_credential'; chain_id: number; value: SearchValidatorsByWithdrwalCredential } | { type: 'validators_by_graffiti'; chain_id: number; value: SearchValidatorsByGraffiti })[]; + data: ( + | { type: 'validator'; chain_id: number; value: SearchValidator } + | { type: 'validator_list'; chain_id: number; value: SearchValidatorList } + | { type: 'validators_by_deposit_address'; chain_id: number; value: SearchValidatorsByDepositAddress } + | { type: 'validators_by_withdrawal_credential'; chain_id: number; value: SearchValidatorsByWithdrwalCredential } + | { type: 'validators_by_graffiti'; chain_id: number; value: SearchValidatorsByGraffiti } + )[] } diff --git a/src/app/requests/v2-search.ts b/src/app/requests/v2-search.ts index 6e361a95..91f17bb5 100644 --- a/src/app/requests/v2-search.ts +++ b/src/app/requests/v2-search.ts @@ -16,7 +16,13 @@ // along with Beaconchain Dashboard. If not, see . import { APIRequest, Method } from './requests' -import { SearchValidator, SearchValidatorList, SearchValidatorsByDepositAddress, SearchValidatorsByGraffiti, SearchValidatorsByWithdrwalCredential } from './types/search' +import { + SearchValidator, + SearchValidatorList, + SearchValidatorsByDepositAddress, + SearchValidatorsByGraffiti, + SearchValidatorsByWithdrwalCredential, +} from './types/search' import { networkID } from './v2-dashboard' // possible search types for a search request @@ -29,7 +35,7 @@ export enum searchType { validatorsByWithdrawalAddress = 'validators_by_withdrawal_address', validatorsByWithdrawalEns = 'validators_by_withdrawal_ens_name', validatorsByGraffiti = 'validators_by_graffiti', - validatorList = 'validator_list' + validatorList = 'validator_list', } // Possible data types of a search response @@ -38,10 +44,15 @@ export enum SearchResponseType { validatorList = 'validator_list', validatorsByDepositAddress = 'validators_by_deposit_address', validatorsByWithdrawalCredential = 'validators_by_withdrawal_credential', - validatorsByGraffiti = 'validators_by_graffiti' + validatorsByGraffiti = 'validators_by_graffiti', } -export type SearchResultData = ({ type: 'validator'; chain_id: number; value: SearchValidator } | { type: 'validator_list'; chain_id: number; value: SearchValidatorList } | { type: 'validators_by_deposit_address'; chain_id: number; value: SearchValidatorsByDepositAddress } | { type: 'validators_by_withdrawal_credential'; chain_id: number; value: SearchValidatorsByWithdrwalCredential } | { type: 'validators_by_graffiti'; chain_id: number; value: SearchValidatorsByGraffiti }); +export type SearchResultData = + | { type: 'validator'; chain_id: number; value: SearchValidator } + | { type: 'validator_list'; chain_id: number; value: SearchValidatorList } + | { type: 'validators_by_deposit_address'; chain_id: number; value: SearchValidatorsByDepositAddress } + | { type: 'validators_by_withdrawal_credential'; chain_id: number; value: SearchValidatorsByWithdrwalCredential } + | { type: 'validators_by_graffiti'; chain_id: number; value: SearchValidatorsByGraffiti } export class V2SearchValidators extends APIRequest { resource = 'search' diff --git a/src/app/services/api.spec.ts b/src/app/services/api.spec.ts index 949d8ff3..042aa18f 100644 --- a/src/app/services/api.spec.ts +++ b/src/app/services/api.spec.ts @@ -1,32 +1,32 @@ // Copyright (C) 2025 Bitfly GmbH -// +// // This file is part of Beaconchain Dashboard. -// +// // Beaconchain Dashboard is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. -// +// // Beaconchain Dashboard is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -// +// // You should have received a copy of the GNU General Public License // along with Beaconchain Dashboard. If not, see . -import { TestBed } from '@angular/core/testing'; -import { ApiService } from './api.service'; +import { TestBed } from '@angular/core/testing' +import { ApiService } from './api.service' describe('AuthService', () => { - let api: ApiService; + let api: ApiService - beforeEach(() => { - TestBed.configureTestingModule({}); - api = TestBed.inject(ApiService); - }); + beforeEach(() => { + TestBed.configureTestingModule({}) + api = TestBed.inject(ApiService) + }) - it('should be created', () => { - expect(api).toBeTruthy(); - }); -}); + it('should be created', () => { + expect(api).toBeTruthy() + }) +}) diff --git a/src/app/tabs/tab-dashboard/tab-dashboard.page.scss b/src/app/tabs/tab-dashboard/tab-dashboard.page.scss index 544d5f93..8d1fe8b1 100644 --- a/src/app/tabs/tab-dashboard/tab-dashboard.page.scss +++ b/src/app/tabs/tab-dashboard/tab-dashboard.page.scss @@ -88,12 +88,12 @@ ion-refresher-content { .sub-text { --color: var(--x-toolbar-title-color); - left: 0; - top: 40px; - bottom: 0; - margin: auto; - position: absolute; - width: 100%; - text-align: center; + left: 0; + top: 40px; + bottom: 0; + margin: auto; + position: absolute; + width: 100%; + text-align: center; font-size: 0.65rem; } diff --git a/src/app/tabs/tab-validators/tab-validators.page.html b/src/app/tabs/tab-validators/tab-validators.page.html index ca9d3d01..90ea7db5 100644 --- a/src/app/tabs/tab-validators/tab-validators.page.html +++ b/src/app/tabs/tab-validators/tab-validators.page.html @@ -93,9 +93,7 @@ {{ dashboardUtils.searchResultHandler.resultCount(item) }} Validators - Validator {{item.value.index}} + Validator {{item.value.index}} Found via {{ dashboardUtils.searchResultHandler.formatSearchType(item.type) }}
diff --git a/src/app/utils/Formatting.ts b/src/app/utils/Formatting.ts index 63568373..fecec08b 100644 --- a/src/app/utils/Formatting.ts +++ b/src/app/utils/Formatting.ts @@ -1,25 +1,25 @@ // Copyright (C) 2024 Bitfly GmbH -// +// // This file is part of Beaconchain Dashboard. -// +// // Beaconchain Dashboard is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. -// +// // Beaconchain Dashboard is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -// +// // You should have received a copy of the GNU General Public License // along with Beaconchain Dashboard. If not, see . -import { Address } from "@requests/types/common"; +import { Address } from '@requests/types/common' export function formatAddress(address: Address): string { - if (address.ens) { - return address.ens.substring(0, 6) - } - return address.hash.substring(0, 6) + '…' + address.hash.substring(address.hash.length-4) -} \ No newline at end of file + if (address.ens) { + return address.ens.substring(0, 6) + } + return address.hash.substring(0, 6) + '…' + address.hash.substring(address.hash.length - 4) +} diff --git a/src/test.ts b/src/test.ts index 08d6c37f..c515c0a1 100644 --- a/src/test.ts +++ b/src/test.ts @@ -19,18 +19,17 @@ // This file is required by karma.conf.js and loads recursively all the .spec and framework files -import 'zone.js/testing'; -import { getTestBed } from '@angular/core/testing'; -import { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing'; +import 'zone.js/testing' +import { getTestBed } from '@angular/core/testing' +import { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing' -getTestBed().initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting()); +getTestBed().initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting()) async function importAllTests() { - const context = import.meta.glob('./**/*.spec.ts'); // Dynamically import all spec files - for (const path in context) { - await context[path](); - } + const context = import.meta.glob('./**/*.spec.ts') // Dynamically import all spec files + for (const path in context) { + await context[path]() + } } -importAllTests().then(() => console.log('All tests loaded.')); - +importAllTests().then(() => console.log('All tests loaded.'))