mirror of
https://github.com/Ride-The-Lightning/RTL
synced 2024-11-15 18:13:00 +00:00
ng test fix
ng test fix
This commit is contained in:
parent
86bfbe4174
commit
5c545946ad
13833
package-lock.json
generated
13833
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -41,7 +41,7 @@
|
||||
"@ngrx/store": "^12.0.0",
|
||||
"@swimlane/ngx-charts": "^16.0.0",
|
||||
"angular-user-idle": "^2.2.5",
|
||||
"angularx-qrcode": "^11.0.0",
|
||||
"angularx-qrcode": "^1.6.4",
|
||||
"atob": "^2.1.2",
|
||||
"cookie-parser": "^1.4.5",
|
||||
"csurf": "^1.11.0",
|
||||
@ -59,7 +59,7 @@
|
||||
"rxjs": "^7.1.0",
|
||||
"sequelize": "^6.7.0",
|
||||
"sha256": "^0.2.0",
|
||||
"sqlite3": "^5.0.2",
|
||||
"sqlite3": "^4.2.0",
|
||||
"tslib": "^2.0.0",
|
||||
"typescript": "~4.2.4",
|
||||
"uuidv4": "^6.2.12",
|
||||
@ -67,7 +67,7 @@
|
||||
"zone.js": "~0.11.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@angular-devkit/build-angular": "~12.0.1",
|
||||
"@angular-devkit/build-angular": "^13.0.3",
|
||||
"@angular-eslint/builder": "12.0.0",
|
||||
"@angular-eslint/eslint-plugin": "12.0.0",
|
||||
"@angular-eslint/eslint-plugin-template": "12.0.0",
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { LoggerService } from '../../../shared/services/logger.service';
|
||||
import { SharedModule } from '../../../shared/shared.module';
|
||||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
||||
|
||||
import { CLNodeLookupComponent } from './node-lookup.component';
|
||||
|
||||
@ -11,7 +12,10 @@ describe('CLNodeLookupComponent', () => {
|
||||
beforeEach(waitForAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [CLNodeLookupComponent],
|
||||
imports: [SharedModule],
|
||||
imports: [
|
||||
SharedModule,
|
||||
BrowserAnimationsModule
|
||||
],
|
||||
providers: [LoggerService]
|
||||
}).
|
||||
compileComponents();
|
||||
@ -20,6 +24,7 @@ describe('CLNodeLookupComponent', () => {
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(CLNodeLookupComponent);
|
||||
component = fixture.componentInstance;
|
||||
component.lookupResult = {};
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
|
@ -11,6 +11,7 @@ import { LNDReducer } from '../../lnd/store/lnd.reducers';
|
||||
import { CLReducer } from '../../clightning/store/cl.reducers';
|
||||
import { ECLReducer } from '../../eclair/store/ecl.reducers';
|
||||
import { CLFeeRatesComponent } from './fee-rates/fee-rates.component';
|
||||
import { CLOnChainFeeEstimatesComponent } from './on-chain-fee-estimates/on-chain-fee-estimates.component';
|
||||
import { CLNetworkInfoComponent } from './network-info.component';
|
||||
|
||||
describe('CLNetworkInfoComponent', () => {
|
||||
@ -19,7 +20,7 @@ describe('CLNetworkInfoComponent', () => {
|
||||
|
||||
beforeEach(waitForAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [CLNetworkInfoComponent, CLFeeRatesComponent],
|
||||
declarations: [CLNetworkInfoComponent, CLFeeRatesComponent, CLOnChainFeeEstimatesComponent],
|
||||
imports: [
|
||||
SharedModule,
|
||||
StoreModule.forRoot({ root: RootReducer, lnd: LNDReducer, cl: CLReducer, ecl: ECLReducer })
|
||||
|
@ -1,7 +1,7 @@
|
||||
<div fxLayout="column" fxLayout.gt-sm="row" fxLayoutAlign="space-between stretch">
|
||||
<div fxFlex="35" [fxLayoutAlign]="invoice.bolt11 && invoice.bolt11 !== '' ? 'center start' : 'center center'" class="modal-qr-code-container padding-gap-large" [ngClass]="{'display-none': screenSize === screenSizeEnum.XS || screenSize === screenSizeEnum.SM}">
|
||||
<qrcode *ngIf="invoice.bolt11 && invoice.bolt11 !== ''" [qrdata]="invoice.bolt11" [margin]="2" [width]="qrWidth" [errorCorrectionLevel]="'L'" [allowEmptyString]="true"></qrcode>
|
||||
<span *ngIf="!invoice.bolt11 || invoice.bolt11 === ''" class="font-size-300">N/A</span>
|
||||
<div fxFlex="35" [fxLayoutAlign]="invoice?.bolt11 && invoice?.bolt11 !== '' ? 'center start' : 'center center'" class="modal-qr-code-container padding-gap-large" [ngClass]="{'display-none': screenSize === screenSizeEnum.XS || screenSize === screenSizeEnum.SM}">
|
||||
<qrcode *ngIf="invoice?.bolt11 && invoice?.bolt11 !== ''" [qrdata]="invoice?.bolt11" [margin]="2" [width]="qrWidth" [errorCorrectionLevel]="'L'" [allowEmptyString]="true"></qrcode>
|
||||
<span *ngIf="!invoice?.bolt11 || invoice?.bolt11 === ''" class="font-size-300">N/A</span>
|
||||
</div>
|
||||
<div fxFlex="65">
|
||||
<mat-card-header fxLayout="row" fxLayoutAlign="space-between center" class="modal-info-header">
|
||||
@ -13,27 +13,27 @@
|
||||
</mat-card-header>
|
||||
<mat-card-content class="padding-gap-x-large" [ngClass]="{'xs-scroll-y': screenSize === screenSizeEnum.XS}">
|
||||
<div fxLayout="column">
|
||||
<div fxFlex="30" [fxLayoutAlign]="invoice.bolt11 && invoice.bolt11 !== '' ? 'center start' : 'center center'" class="modal-qr-code-container padding-gap" [ngClass]="{'display-none': screenSize !== screenSizeEnum.XS && screenSize !== screenSizeEnum.SM}">
|
||||
<qrcode *ngIf="invoice.bolt11 && invoice.bolt11 !== ''" [qrdata]="invoice.bolt11" [margin]="2" [width]="qrWidth" [errorCorrectionLevel]="'L'" [allowEmptyString]="true"></qrcode>
|
||||
<span *ngIf="!invoice.bolt11 || invoice.bolt11 === ''" class="font-size-120">QR Code Not Applicable</span>
|
||||
<div fxFlex="30" [fxLayoutAlign]="invoice?.bolt11 && invoice?.bolt11 !== '' ? 'center start' : 'center center'" class="modal-qr-code-container padding-gap" [ngClass]="{'display-none': screenSize !== screenSizeEnum.XS && screenSize !== screenSizeEnum.SM}">
|
||||
<qrcode *ngIf="invoice?.bolt11 && invoice?.bolt11 !== ''" [qrdata]="invoice?.bolt11" [margin]="2" [width]="qrWidth" [errorCorrectionLevel]="'L'" [allowEmptyString]="true"></qrcode>
|
||||
<span *ngIf="!invoice?.bolt11 || invoice?.bolt11 === ''" class="font-size-120">QR Code Not Applicable</span>
|
||||
</div>
|
||||
<mat-divider *ngIf="screenSize === screenSizeEnum.XS || screenSize === screenSizeEnum.SM" [inset]="true" class="my-1"></mat-divider>
|
||||
<div fxLayout="row" *ngIf="invoice.warning_capacity">
|
||||
<div fxLayout="row" *ngIf="invoice?.warning_capacity">
|
||||
<div fxFlex="100" class="alert alert-warn">
|
||||
<fa-icon [icon]="faExclamationTriangle" class="mr-1 alert-icon"></fa-icon>
|
||||
<span>{{invoice.warning_capacity}}</span>
|
||||
<span>{{invoice?.warning_capacity}}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div fxLayout="row">
|
||||
<div fxFlex="50">
|
||||
<h4 fxLayoutAlign="start" class="font-bold-500">{{screenSize === screenSizeEnum.XS ? 'Amount' : 'Amount Requested'}}</h4>
|
||||
<span class="foreground-secondary-text">{{(invoice.msatoshi/1000 || 0) | number}} Sats<ng-container *ngIf="!invoice.msatoshi || invoice?.msatoshi === '0'"> (zero amount) </ng-container></span>
|
||||
<span class="foreground-secondary-text">{{(invoice?.msatoshi/1000 || 0) | number}} Sats<ng-container *ngIf="!invoice?.msatoshi || invoice?.msatoshi === '0'"> (zero amount) </ng-container></span>
|
||||
</div>
|
||||
<div fxFlex="50">
|
||||
<h4 fxLayoutAlign="start" class="font-bold-500">Amount Received</h4>
|
||||
<span class="overflow-wrap foreground-secondary-text">
|
||||
<span *ngIf="invoice.status !== 'unpaid'">{{invoice.msatoshi_received/1000 | number}} {{invoice.msatoshi_received ? 'Sats' : '-'}}</span>
|
||||
<mat-spinner [diameter]="20" *ngIf="invoice.status === 'unpaid'"></mat-spinner>
|
||||
<span *ngIf="invoice?.status !== 'unpaid'">{{invoice?.msatoshi_received/1000 | number}} {{invoice?.msatoshi_received ? 'Sats' : '-'}}</span>
|
||||
<mat-spinner [diameter]="20" *ngIf="invoice?.status === 'unpaid'"></mat-spinner>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@ -41,25 +41,25 @@
|
||||
<div fxLayout="row">
|
||||
<div fxFlex="50">
|
||||
<h4 fxLayoutAlign="start" class="font-bold-500">Date Expiry</h4>
|
||||
<span class="foreground-secondary-text">{{(invoice.expires_at * 1000) | date:'dd/MMM/YYYY HH:mm'}}</span>
|
||||
<span class="foreground-secondary-text">{{(invoice?.expires_at * 1000) | date:'dd/MMM/YYYY HH:mm'}}</span>
|
||||
</div>
|
||||
<div fxFlex="50">
|
||||
<h4 fxLayoutAlign="start" class="font-bold-500">Status</h4>
|
||||
<span class="overflow-wrap foreground-secondary-text">{{invoice.status | titlecase}}</span>
|
||||
<span class="overflow-wrap foreground-secondary-text">{{invoice?.status | titlecase}}</span>
|
||||
</div>
|
||||
</div>
|
||||
<mat-divider class="w-100 my-1"></mat-divider>
|
||||
<div fxLayout="row">
|
||||
<div fxFlex="100">
|
||||
<h4 fxLayoutAlign="start" class="font-bold-500">Description</h4>
|
||||
<span class="foreground-secondary-text">{{invoice.description || '-'}}</span>
|
||||
<span class="foreground-secondary-text">{{invoice?.description || '-'}}</span>
|
||||
</div>
|
||||
</div>
|
||||
<mat-divider class="w-100 my-1"></mat-divider>
|
||||
<div fxLayout="row">
|
||||
<div fxFlex="100">
|
||||
<h4 fxLayoutAlign="start" class="font-bold-500">Invoice</h4>
|
||||
<span class="overflow-wrap foreground-secondary-text">{{invoice.bolt11 || 'N/A'}}</span>
|
||||
<span class="overflow-wrap foreground-secondary-text">{{invoice?.bolt11 || 'N/A'}}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="showAdvanced">
|
||||
@ -67,18 +67,18 @@
|
||||
<div fxLayout="row">
|
||||
<div fxFlex="100">
|
||||
<h4 fxLayoutAlign="start" class="font-bold-500">Payment Hash</h4>
|
||||
<span class="overflow-wrap foreground-secondary-text">{{invoice.payment_hash}}</span>
|
||||
<span class="overflow-wrap foreground-secondary-text">{{invoice?.payment_hash}}</span>
|
||||
</div>
|
||||
</div>
|
||||
<mat-divider class="w-100 my-1"></mat-divider>
|
||||
<div fxLayout="row">
|
||||
<div fxFlex="50">
|
||||
<h4 fxLayoutAlign="start" class="font-bold-500">Label</h4>
|
||||
<span class="overflow-wrap foreground-secondary-text">{{invoice.label}}</span>
|
||||
<span class="overflow-wrap foreground-secondary-text">{{invoice?.label}}</span>
|
||||
</div>
|
||||
<div fxFlex="50">
|
||||
<h4 fxLayoutAlign="start" class="font-bold-500">Date Settled</h4>
|
||||
<span class="foreground-secondary-text">{{((invoice.paid_at * 1000) | date:'dd/MMM/YYYY HH:mm') || '-'}}</span>
|
||||
<span class="foreground-secondary-text">{{((invoice?.paid_at * 1000) | date:'dd/MMM/YYYY HH:mm') || '-'}}</span>
|
||||
</div>
|
||||
</div>
|
||||
<mat-divider class="w-100 my-1"></mat-divider>
|
||||
@ -88,8 +88,8 @@
|
||||
<p *ngIf="!showAdvanced; else hideAdvancedText">Show Advanced</p>
|
||||
<ng-template #hideAdvancedText><p>Hide Advanced</p></ng-template>
|
||||
</button>
|
||||
<button *ngIf="invoice.bolt11 && invoice.bolt11 !== ''" autoFocus mat-flat-button color="primary" tabindex="2" type="submit" rtlClipboard [payload]="invoice.bolt11" (copied)="onCopyPayment($event)">Copy Invoice</button>
|
||||
<button *ngIf="!invoice.bolt11 || invoice.bolt11 === ''" autoFocus mat-flat-button color="primary" tabindex="2" type="button" (click)="onClose()">OK</button>
|
||||
<button *ngIf="invoice?.bolt11 && invoice?.bolt11 !== ''" autoFocus mat-flat-button color="primary" tabindex="2" type="submit" rtlClipboard [payload]="invoice?.bolt11" (copied)="onCopyPayment($event)">Copy Invoice</button>
|
||||
<button *ngIf="!invoice?.bolt11 || invoice?.bolt11 === ''" autoFocus mat-flat-button color="primary" tabindex="2" type="button" (click)="onClose()">OK</button>
|
||||
</div>
|
||||
</div>
|
||||
</mat-card-content>
|
||||
|
@ -1,6 +1,11 @@
|
||||
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
||||
import { Store, StoreModule } from '@ngrx/store';
|
||||
|
||||
import { RootReducer } from '../../../store/rtl.reducers';
|
||||
import { LNDReducer } from '../../../lnd/store/lnd.reducers';
|
||||
import { CLReducer } from '../../../clightning/store/cl.reducers';
|
||||
import { ECLReducer } from '../../../eclair/store/ecl.reducers';
|
||||
import { CommonService } from '../../../shared/services/common.service';
|
||||
import { LoggerService } from '../../../shared/services/logger.service';
|
||||
|
||||
@ -8,15 +13,23 @@ import { CLInvoiceInformationComponent } from './invoice-information.component';
|
||||
import { mockDataService, mockLoggerService, mockMatDialogRef } from '../../../shared/test-helpers/mock-services';
|
||||
import { SharedModule } from '../../../shared/shared.module';
|
||||
import { DataService } from '../../../shared/services/data.service';
|
||||
import { RTLState } from '../../../store/rtl.state';
|
||||
import { listInvoices } from '../../store/cl.selector';
|
||||
import { ApiCallStatusPayload } from '../../../shared/models/apiCallsPayload';
|
||||
import { ListInvoices } from '../../../shared/models/clModels';
|
||||
|
||||
describe('CLInvoiceInformationComponent', () => {
|
||||
let component: CLInvoiceInformationComponent;
|
||||
let fixture: ComponentFixture<CLInvoiceInformationComponent>;
|
||||
let store: Store<RTLState>;
|
||||
|
||||
beforeEach(waitForAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [CLInvoiceInformationComponent],
|
||||
imports: [SharedModule],
|
||||
imports: [
|
||||
SharedModule,
|
||||
StoreModule.forRoot({ root: RootReducer, lnd: LNDReducer, cl: CLReducer, ecl: ECLReducer })
|
||||
],
|
||||
providers: [
|
||||
CommonService,
|
||||
{ provide: LoggerService, useClass: mockLoggerService },
|
||||
@ -31,6 +44,7 @@ describe('CLInvoiceInformationComponent', () => {
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(CLInvoiceInformationComponent);
|
||||
component = fixture.componentInstance;
|
||||
store = fixture.debugElement.injector.get(Store);
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
|
@ -43,10 +43,10 @@ export class CLInvoiceInformationComponent implements OnInit, OnDestroy {
|
||||
this.qrWidth = 220;
|
||||
}
|
||||
this.store.select(listInvoices).pipe(takeUntil(this.unSubs[0])).
|
||||
subscribe((invoicesSeletor: { listInvoices: ListInvoices, apiCallStatus: ApiCallStatusPayload }) => {
|
||||
const invoices = invoicesSeletor.listInvoices.invoices || [];
|
||||
subscribe((invoicesSelector: { listInvoices: ListInvoices, apiCallStatus: ApiCallStatusPayload }) => {
|
||||
const invoices = invoicesSelector.listInvoices.invoices || [];
|
||||
this.invoice = invoices.find((invoice) => invoice.payment_hash === this.invoice.payment_hash);
|
||||
this.logger.info(invoicesSeletor);
|
||||
this.logger.info(invoicesSelector);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -25,6 +25,7 @@ describe('ECLNodeLookupComponent', () => {
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ECLNodeLookupComponent);
|
||||
component = fixture.componentInstance;
|
||||
component.lookupResult = { features: { activated: [] } };
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
<div fxLayout="column" fxLayout.gt-sm="row" fxLayoutAlign="space-between stretch">
|
||||
<div fxFlex="35" [fxLayoutAlign]="invoice.serialized && invoice.serialized !== '' ? 'center start' : 'center center'" class="modal-qr-code-container padding-gap-large" [ngClass]="{'display-none': screenSize === screenSizeEnum.XS || screenSize === screenSizeEnum.SM}">
|
||||
<qrcode *ngIf="invoice.serialized && invoice.serialized !== ''" [qrdata]="invoice.serialized" [margin]="2" [width]="qrWidth" [errorCorrectionLevel]="'L'" [allowEmptyString]="true"></qrcode>
|
||||
<span *ngIf="!invoice.serialized || invoice.serialized === ''" class="font-size-300">N/A</span>
|
||||
<div fxFlex="35" [fxLayoutAlign]="invoice?.serialized && invoice?.serialized !== '' ? 'center start' : 'center center'" class="modal-qr-code-container padding-gap-large" [ngClass]="{'display-none': screenSize === screenSizeEnum.XS || screenSize === screenSizeEnum.SM}">
|
||||
<qrcode *ngIf="invoice?.serialized && invoice?.serialized !== ''" [qrdata]="invoice?.serialized" [margin]="2" [width]="qrWidth" [errorCorrectionLevel]="'L'" [allowEmptyString]="true"></qrcode>
|
||||
<span *ngIf="!invoice?.serialized || invoice?.serialized === ''" class="font-size-300">N/A</span>
|
||||
</div>
|
||||
<div fxFlex="65">
|
||||
<mat-card-header fxLayout="row" fxLayoutAlign="space-between center" class="modal-info-header">
|
||||
@ -13,23 +13,23 @@
|
||||
</mat-card-header>
|
||||
<mat-card-content class="padding-gap-x-large" [ngClass]="{'xs-scroll-y': screenSize === screenSizeEnum.XS}">
|
||||
<div fxLayout="column">
|
||||
<div fxFlex="30" [fxLayoutAlign]="invoice.serialized && invoice.serialized !== '' ? 'center start' : 'center center'" class="modal-qr-code-container padding-gap" [ngClass]="{'display-none': screenSize !== screenSizeEnum.XS && screenSize !== screenSizeEnum.SM}">
|
||||
<qrcode *ngIf="invoice.serialized && invoice.serialized !== ''" [qrdata]="invoice.serialized" [margin]="2" [width]="qrWidth" [errorCorrectionLevel]="'L'" [allowEmptyString]="true"></qrcode>
|
||||
<span *ngIf="!invoice.serialized || invoice.serialized === ''" class="font-size-120">QR Code Not Applicable</span>
|
||||
<div fxFlex="30" [fxLayoutAlign]="invoice?.serialized && invoice?.serialized !== '' ? 'center start' : 'center center'" class="modal-qr-code-container padding-gap" [ngClass]="{'display-none': screenSize !== screenSizeEnum.XS && screenSize !== screenSizeEnum.SM}">
|
||||
<qrcode *ngIf="invoice?.serialized && invoice?.serialized !== ''" [qrdata]="invoice?.serialized" [margin]="2" [width]="qrWidth" [errorCorrectionLevel]="'L'" [allowEmptyString]="true"></qrcode>
|
||||
<span *ngIf="!invoice?.serialized || invoice?.serialized === ''" class="font-size-120">QR Code Not Applicable</span>
|
||||
</div>
|
||||
<mat-divider *ngIf="screenSize === screenSizeEnum.XS || screenSize === screenSizeEnum.SM" [inset]="true" class="my-1"></mat-divider>
|
||||
<div fxLayout="row">
|
||||
<div fxFlex="50">
|
||||
<h4 fxLayoutAlign="start" class="font-bold-500">Amount Requested</h4>
|
||||
<span class="foreground-secondary-text">{{(invoice.amount || 0) | number}} Sats<ng-container *ngIf="!invoice.amount || invoice?.amount === '0'"> (zero amount) </ng-container></span>
|
||||
<span class="foreground-secondary-text">{{(invoice?.amount || 0) | number}} Sats<ng-container *ngIf="!invoice?.amount || invoice?.amount === '0'"> (zero amount) </ng-container></span>
|
||||
</div>
|
||||
<div fxFlex="50">
|
||||
<h4 fxLayoutAlign="start" class="font-bold-500">Amount Settled</h4>
|
||||
<span class="foreground-secondary-text">
|
||||
<ng-container *ngIf="invoice.amountSettled">{{invoice.amountSettled | number}} Sats</ng-container>
|
||||
<ng-container *ngIf="!invoice.amountSettled">
|
||||
<span *ngIf="invoice.status !== 'unpaid'">-</span>
|
||||
<mat-spinner [diameter]="20" *ngIf="invoice.status === 'unpaid'"></mat-spinner>
|
||||
<ng-container *ngIf="invoice?.amountSettled">{{invoice?.amountSettled | number}} Sats</ng-container>
|
||||
<ng-container *ngIf="!invoice?.amountSettled">
|
||||
<span *ngIf="invoice?.status !== 'unpaid'">-</span>
|
||||
<mat-spinner [diameter]="20" *ngIf="invoice?.status === 'unpaid'"></mat-spinner>
|
||||
</ng-container>
|
||||
</span>
|
||||
</div>
|
||||
@ -38,25 +38,25 @@
|
||||
<div fxLayout="row">
|
||||
<div fxFlex="50">
|
||||
<h4 fxLayoutAlign="start" class="font-bold-500">Date Created</h4>
|
||||
<span class="overflow-wrap foreground-secondary-text">{{(invoice.timestamp * 1000) | date:'dd/MMM/YYYY HH:mm'}}</span>
|
||||
<span class="overflow-wrap foreground-secondary-text">{{(invoice?.timestamp * 1000) | date:'dd/MMM/YYYY HH:mm'}}</span>
|
||||
</div>
|
||||
<div fxFlex="50">
|
||||
<h4 fxLayoutAlign="start" class="font-bold-500">Status</h4>
|
||||
<span class="overflow-wrap foreground-secondary-text">{{invoice.status | titlecase}}</span>
|
||||
<span class="overflow-wrap foreground-secondary-text">{{invoice?.status | titlecase}}</span>
|
||||
</div>
|
||||
</div>
|
||||
<mat-divider class="w-100 my-1"></mat-divider>
|
||||
<div fxLayout="row">
|
||||
<div fxFlex="100">
|
||||
<h4 fxLayoutAlign="start" class="font-bold-500">Description</h4>
|
||||
<span class="foreground-secondary-text">{{invoice.description || '-'}}</span>
|
||||
<span class="foreground-secondary-text">{{invoice?.description || '-'}}</span>
|
||||
</div>
|
||||
</div>
|
||||
<mat-divider class="w-100 my-1"></mat-divider>
|
||||
<div fxLayout="row">
|
||||
<div fxFlex="100">
|
||||
<h4 fxLayoutAlign="start" class="font-bold-500">Invoice</h4>
|
||||
<span class="overflow-wrap foreground-secondary-text">{{invoice.serialized || 'N/A'}}</span>
|
||||
<span class="overflow-wrap foreground-secondary-text">{{invoice?.serialized || 'N/A'}}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="showAdvanced">
|
||||
@ -64,25 +64,25 @@
|
||||
<div fxLayout="row">
|
||||
<div fxFlex="40">
|
||||
<h4 fxLayoutAlign="start" class="font-bold-500">Date Expiry</h4>
|
||||
<span class="foreground-secondary-text">{{(invoice.expiresAt * 1000) | date:'dd/MMM/YYYY HH:mm'}}</span>
|
||||
<span class="foreground-secondary-text">{{(invoice?.expiresAt * 1000) | date:'dd/MMM/YYYY HH:mm'}}</span>
|
||||
</div>
|
||||
<div fxFlex="60">
|
||||
<h4 fxLayoutAlign="start" class="font-bold-500">Date Settled</h4>
|
||||
<span class="overflow-wrap foreground-secondary-text">{{(invoice.receivedAt * 1000) | date:'dd/MMM/YYYY HH:mm'}}</span>
|
||||
<span class="overflow-wrap foreground-secondary-text">{{(invoice?.receivedAt * 1000) | date:'dd/MMM/YYYY HH:mm'}}</span>
|
||||
</div>
|
||||
</div>
|
||||
<mat-divider class="w-100 my-1"></mat-divider>
|
||||
<div fxLayout="row">
|
||||
<div fxFlex="100">
|
||||
<h4 fxLayoutAlign="start" class="font-bold-500">Payment Hash</h4>
|
||||
<span class="overflow-wrap foreground-secondary-text">{{invoice.paymentHash}}</span>
|
||||
<span class="overflow-wrap foreground-secondary-text">{{invoice?.paymentHash}}</span>
|
||||
</div>
|
||||
</div>
|
||||
<mat-divider class="w-100 my-1"></mat-divider>
|
||||
<div fxLayout="row">
|
||||
<div fxFlex="100">
|
||||
<h4 fxLayoutAlign="start" class="font-bold-500">Node Id</h4>
|
||||
<span class="overflow-wrap foreground-secondary-text">{{invoice.nodeId}}</span>
|
||||
<span class="overflow-wrap foreground-secondary-text">{{invoice?.nodeId}}</span>
|
||||
</div>
|
||||
</div>
|
||||
<mat-divider class="w-100 my-1"></mat-divider>
|
||||
@ -92,8 +92,8 @@
|
||||
<p *ngIf="!showAdvanced; else hideAdvancedText">Show Advanced</p>
|
||||
<ng-template #hideAdvancedText><p>Hide Advanced</p></ng-template>
|
||||
</button>
|
||||
<button *ngIf="invoice.serialized && invoice.serialized !== ''" autoFocus mat-flat-button color="primary" tabindex="2" type="submit" rtlClipboard [payload]="invoice.serialized" (copied)="onCopyPayment($event)">Copy Invoice</button>
|
||||
<button *ngIf="!invoice.serialized || invoice.serialized === ''" autoFocus mat-flat-button color="primary" tabindex="2" type="button" (click)="onClose()">OK</button>
|
||||
<button *ngIf="invoice?.serialized && invoice?.serialized !== ''" autoFocus mat-flat-button color="primary" tabindex="2" type="submit" rtlClipboard [payload]="invoice?.serialized" (copied)="onCopyPayment($event)">Copy Invoice</button>
|
||||
<button *ngIf="!invoice?.serialized || invoice?.serialized === ''" autoFocus mat-flat-button color="primary" tabindex="2" type="button" (click)="onClose()">OK</button>
|
||||
</div>
|
||||
</div>
|
||||
</mat-card-content>
|
||||
|
@ -1,6 +1,11 @@
|
||||
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
||||
import { StoreModule, Store } from '@ngrx/store';
|
||||
|
||||
import { RootReducer } from '../../../store/rtl.reducers';
|
||||
import { LNDReducer } from '../../../lnd/store/lnd.reducers';
|
||||
import { CLReducer } from '../../../clightning/store/cl.reducers';
|
||||
import { ECLReducer } from '../../../eclair/store/ecl.reducers';
|
||||
import { CommonService } from '../../../shared/services/common.service';
|
||||
import { LoggerService } from '../../../shared/services/logger.service';
|
||||
|
||||
@ -8,15 +13,23 @@ import { ECLInvoiceInformationComponent } from './invoice-information.component'
|
||||
import { mockDataService, mockLoggerService, mockMatDialogRef } from '../../../shared/test-helpers/mock-services';
|
||||
import { SharedModule } from '../../../shared/shared.module';
|
||||
import { DataService } from '../../../shared/services/data.service';
|
||||
import { RTLState } from '../../../store/rtl.state';
|
||||
import { ApiCallStatusPayload } from '../../../shared/models/apiCallsPayload';
|
||||
import { invoices } from '../../store/ecl.selector';
|
||||
import { Invoice } from '../../../shared/models/eclModels';
|
||||
|
||||
describe('ECLInvoiceInformationComponent', () => {
|
||||
let component: ECLInvoiceInformationComponent;
|
||||
let fixture: ComponentFixture<ECLInvoiceInformationComponent>;
|
||||
let store: Store<RTLState>;
|
||||
|
||||
beforeEach(waitForAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ECLInvoiceInformationComponent],
|
||||
imports: [SharedModule],
|
||||
imports: [
|
||||
SharedModule,
|
||||
StoreModule.forRoot({ root: RootReducer, lnd: LNDReducer, cl: CLReducer, ecl: ECLReducer })
|
||||
],
|
||||
providers: [
|
||||
CommonService,
|
||||
{ provide: LoggerService, useClass: mockLoggerService },
|
||||
@ -31,6 +44,7 @@ describe('ECLInvoiceInformationComponent', () => {
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ECLInvoiceInformationComponent);
|
||||
component = fixture.componentInstance;
|
||||
store = fixture.debugElement.injector.get(Store);
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
|
@ -39,6 +39,7 @@ describe('BumpFeeComponent', () => {
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(BumpFeeComponent);
|
||||
component = fixture.componentInstance;
|
||||
component.data.pendingChannel = { channel: { channel_point: '' } };
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
|
@ -1,6 +1,11 @@
|
||||
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
||||
import { StoreModule } from '@ngrx/store';
|
||||
|
||||
import { RootReducer } from '../../../store/rtl.reducers';
|
||||
import { LNDReducer } from '../../../lnd/store/lnd.reducers';
|
||||
import { CLReducer } from '../../../clightning/store/cl.reducers';
|
||||
import { ECLReducer } from '../../../eclair/store/ecl.reducers';
|
||||
import { CommonService } from '../../../shared/services/common.service';
|
||||
import { LoggerService } from '../../../shared/services/logger.service';
|
||||
|
||||
@ -16,7 +21,10 @@ describe('InvoiceInformationComponent', () => {
|
||||
beforeEach(waitForAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [InvoiceInformationComponent],
|
||||
imports: [SharedModule],
|
||||
imports: [
|
||||
SharedModule,
|
||||
StoreModule.forRoot({ root: RootReducer, lnd: LNDReducer, cl: CLReducer, ecl: ECLReducer })
|
||||
],
|
||||
providers: [
|
||||
CommonService,
|
||||
{ provide: LoggerService, useClass: mockLoggerService },
|
||||
|
@ -29,18 +29,18 @@
|
||||
<mat-form-field fxFlex="30" fxLayoutAlign="start end">
|
||||
<mat-select tabindex="5" [(value)]="selFeeLimitType" Placeholder="Fee Limits">
|
||||
<mat-option *ngFor="let feeLimitType of feeLimitTypes" [value]="feeLimitType">
|
||||
{{feeLimitType.name}}
|
||||
{{feeLimitType?.name}}
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field fxFlex="26">
|
||||
<input matInput [(ngModel)]="feeLimit" [placeholder]="selFeeLimitType.placeholder" type="number" name="feeLmt" [step]="1" [min]="0" required tabindex="6" #fLmt="ngModel" [disabled]="selFeeLimitType === feeLimitTypes[0]">
|
||||
<mat-error *ngIf="selFeeLimitType !== feeLimitTypes[0] && !feeLimit">{{selFeeLimitType.placeholder}} is required.</mat-error>
|
||||
<input matInput [(ngModel)]="feeLimit" [placeholder]="selfeeLimitType?.placeholder" type="number" name="feeLmt" [step]="1" [min]="0" required tabindex="6" #fLmt="ngModel" [disabled]="selFeeLimitType === feeLimitTypes[0]">
|
||||
<mat-error *ngIf="selFeeLimitType !== feeLimitTypes[0] && !feeLimit">{{selfeeLimitType?.placeholder}} is required.</mat-error>
|
||||
</mat-form-field>
|
||||
<mat-form-field fxFlex="40" fxLayoutAlign="start end">
|
||||
<input type="text" placeholder="First Outgoing Channel" aria-label="First Outgoing Channel" matInput [formControl]="selectedChannelCtrl" [matAutocomplete]="auto" tabindex="7">
|
||||
<mat-autocomplete #auto="matAutocomplete" [displayWith]="displayFn" (optionSelected)="onSelectedChannelChanged()">
|
||||
<mat-option *ngFor="let activeChannel of filteredMinAmtActvChannels" [value]="activeChannel">{{activeChannel.remote_alias || activeChannel.chan_id}}</mat-option>
|
||||
<mat-option *ngFor="let activeChannel of filteredMinAmtActvChannels" [value]="activeChannel">{{activeChannel?.remote_alias || activeChannel?.chan_id}}</mat-option>
|
||||
</mat-autocomplete>
|
||||
<mat-error *ngIf="selectedChannelCtrl.errors?.notfound">Channel not found in the list.</mat-error>
|
||||
</mat-form-field>
|
||||
|
@ -21,6 +21,7 @@ import { mockRTLStoreState } from '../../../shared/test-helpers/test-data';
|
||||
import { RTLState } from '../../../store/rtl.state';
|
||||
import { sendPayment } from '../../store/lnd.actions';
|
||||
import { SelNodeChild } from '../../../shared/models/RTLconfig';
|
||||
import { channels } from '../../store/lnd.selector';
|
||||
|
||||
describe('LightningSendPaymentsComponent', () => {
|
||||
let component: LightningSendPaymentsComponent;
|
||||
@ -52,6 +53,7 @@ describe('LightningSendPaymentsComponent', () => {
|
||||
component = fixture.componentInstance;
|
||||
commonService = fixture.debugElement.injector.get(CommonService);
|
||||
store = fixture.debugElement.injector.get(Store);
|
||||
component.activeChannels = [];
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
@ -60,10 +62,10 @@ describe('LightningSendPaymentsComponent', () => {
|
||||
});
|
||||
|
||||
it('should get lnd store value on ngOnInit', () => {
|
||||
const storeSpy = spyOn(store, 'select').and.returnValue(of(mockRTLStoreState.lnd));
|
||||
const storeSpy = spyOn(store, 'select').and.returnValue(of(mockRTLStoreState.lnd.nodeSettings));
|
||||
component.ngOnInit();
|
||||
expect(component.selNode.lnImplementation).toBe('LND');
|
||||
expect(storeSpy).toHaveBeenCalledTimes(1);
|
||||
expect(storeSpy).toHaveBeenCalledTimes(2);
|
||||
});
|
||||
|
||||
it('should send payment buttons work as expected', () => {
|
||||
|
@ -79,7 +79,7 @@ describe('RTL Root Effects', () => {
|
||||
actions = new ReplaySubject(1);
|
||||
const setSelectedNodeAction = {
|
||||
type: RTLActions.SET_SELECTED_NODE,
|
||||
payload: { uiMessage: UI_MESSAGES.UPDATE_SELECTED_NODE, lnNode: mockActionsData.setSelectedNode, isInitialSetup: false }
|
||||
payload: { uiMessage: UI_MESSAGES.UPDATE_SELECTED_NODE, prevLnNodeIndex: -1, currentLnNode: mockActionsData.setSelectedNode, isInitialSetup: false }
|
||||
};
|
||||
actions.next(setSelectedNodeAction);
|
||||
const sub = effects.setSelectedNode.subscribe((setSelectedNodeResponse) => {
|
||||
@ -102,7 +102,7 @@ describe('RTL Root Effects', () => {
|
||||
const expectedResponse = mockResponseData.setSelectedNodeSuccess;
|
||||
req.flush(expectedResponse);
|
||||
expect(req.request.method).toEqual('POST');
|
||||
expect(req.request.body).toEqual({ selNodeIndex: setSelectedNodeAction.payload.lnNode.index });
|
||||
expect(req.request.body).toEqual({ prevNodeIndex: -1, currNodeIndex: setSelectedNodeAction.payload.currentLnNode.index });
|
||||
});
|
||||
|
||||
it('should throw error on dispatch set selected node', (done) => {
|
||||
@ -111,7 +111,7 @@ describe('RTL Root Effects', () => {
|
||||
actions = new ReplaySubject(1);
|
||||
const setSelectedNodeAction = {
|
||||
type: RTLActions.SET_SELECTED_NODE,
|
||||
payload: { uiMessage: UI_MESSAGES.UPDATE_SELECTED_NODE, lnNode: mockActionsData.setSelectedNode, isInitialSetup: false }
|
||||
payload: { uiMessage: UI_MESSAGES.UPDATE_SELECTED_NODE, prevLnNodeIndex: -1, currentLnNode: mockActionsData.setSelectedNode, isInitialSetup: false }
|
||||
};
|
||||
actions.next(setSelectedNodeAction);
|
||||
const sub = effects.setSelectedNode.subscribe((setSelectedNodeResponse: any) => {
|
||||
|
@ -15,7 +15,7 @@ describe('RTL reducer', () => {
|
||||
|
||||
describe('Action SetSelectedNode', () => {
|
||||
it('should set selected node', () => {
|
||||
const SetSelectedNodeAction = setSelectedNode({ payload: { uiMessage: UI_MESSAGES.NO_SPINNER, lnNode: mockActionsData.setSelectedNode, isInitialSetup: false } });
|
||||
const SetSelectedNodeAction = setSelectedNode({ payload: { uiMessage: UI_MESSAGES.NO_SPINNER, prevLnNodeIndex: -1, currentLnNode: mockActionsData.setSelectedNode, isInitialSetup: false } });
|
||||
const newState = RootReducer(initRootState, SetSelectedNodeAction);
|
||||
|
||||
expect(newState.selNode.settings.themeMode).toBe('NIGHT');
|
||||
|
Loading…
Reference in New Issue
Block a user