2
0
mirror of https://github.com/Ride-The-Lightning/RTL synced 2024-11-07 15:20:31 +00:00

Karma tests basics fixed (#724)

Karma tests basics fixed
This commit is contained in:
ShahanaFarooqui 2021-07-02 11:44:22 -04:00 committed by GitHub
parent cf8844a2d6
commit 7096d9ff0b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
253 changed files with 4329 additions and 969 deletions

View File

@ -10,8 +10,7 @@
],
"parserOptions": {
"project": [
"tsconfig.json",
"e2e/tsconfig.json"
"tsconfig.json"
],
"createDefaultProgram": true
},

View File

@ -116,18 +116,6 @@
"src/**/*.html"
]
}
},
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "RTLApp:serve"
},
"configurations": {
"production": {
"devServerTarget": "RTLApp:serve:production"
}
}
}
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -13,6 +13,5 @@
<style>@font-face{font-family:Roboto;src:url(Roboto-Thin.dbd56bd3357dc3617fe5.woff2) format("woff2"),url(Roboto-Thin.e7f7c82374bd0ebef14b.woff) format("woff");font-weight:100;font-style:normal;}@font-face{font-family:Roboto;src:url(Roboto-ThinItalic.a8cef84f735ef887abdc.woff2) format("woff2"),url(Roboto-ThinItalic.5dd9349c940073834e9a.woff) format("woff");font-weight:100;font-style:italic;}@font-face{font-family:Roboto;src:url(Roboto-Light.c27d89ac77468ae18f28.woff2) format("woff2"),url(Roboto-Light.d923dfafc0c5183b59aa.woff) format("woff");font-weight:300;font-style:normal;}@font-face{font-family:Roboto;src:url(Roboto-LightItalic.506274c7228cf81cae4d.woff2) format("woff2"),url(Roboto-LightItalic.d4b8c137518d9d92bb28.woff) format("woff");font-weight:300;font-style:italic;}@font-face{font-family:Roboto;src:url(Roboto-Regular.64cfb66c866ea50cad47.woff2) format("woff2"),url(Roboto-Regular.e02e9d6ff5547f7e9962.woff) format("woff");font-weight:400;font-style:normal;}@font-face{font-family:Roboto;src:url(Roboto-RegularItalic.4dd2af1e8df532f41db8.woff2) format("woff2"),url(Roboto-RegularItalic.5ea38fff9eebef99c5df.woff) format("woff");font-weight:400;font-style:italic;}@font-face{font-family:Roboto;src:url(Roboto-Medium.1d3bced88509b0838984.woff2) format("woff2"),url(Roboto-Medium.092c6130df8fd2199888.woff) format("woff");font-weight:500;font-style:normal;}@font-face{font-family:Roboto;src:url(Roboto-MediumItalic.d620b8f53f75966fe42e.woff2) format("woff2"),url(Roboto-MediumItalic.18ff1628c628080166c1.woff) format("woff");font-weight:500;font-style:italic;}@font-face{font-family:Roboto;src:url(Roboto-Bold.92fbd4e93cf0a5dbebaa.woff2) format("woff2"),url(Roboto-Bold.73288d91c325e82a5b92.woff) format("woff");font-weight:700;font-style:normal;}@font-face{font-family:Roboto;src:url(Roboto-BoldItalic.5f600d98a73d800ae575.woff2) format("woff2"),url(Roboto-BoldItalic.6d89acbd21d7e3fbecb2.woff) format("woff");font-weight:700;font-style:italic;}@font-face{font-family:Roboto;src:url(Roboto-Black.41ed1105a6ebb8ffe34e.woff2) format("woff2"),url(Roboto-Black.937491dfcbe64ca9a9f1.woff) format("woff");font-weight:900;font-style:normal;}@font-face{font-family:Roboto;src:url(Roboto-BlackItalic.50ca4c51ebc27e7e7d2f.woff2) format("woff2"),url(Roboto-BlackItalic.2e1ee657996854c6f427.woff) format("woff");font-weight:900;font-style:italic;}html{width:100%;height:99%;line-height:1.5;overflow-x:hidden;font-family:Roboto,sans-serif!important;font-size:62.5%;}body{box-sizing:border-box;margin:0;}body{height:100%;overflow:hidden;}*{margin:0;padding:0;}</style><link rel="stylesheet" href="styles.97554e699a42acff6579.css" media="print" onload="this.media='all'"><noscript><link rel="stylesheet" href="styles.97554e699a42acff6579.css"></noscript></head>
<body>
<rtl-app></rtl-app>
<script src="runtime.28bc9723e141277838d0.js" defer></script><script src="polyfills.99f4d82f067fba7525c4.js" defer></script><script src="main.065b850ecdb6122939b7.js" defer></script>
<script src="runtime.57f4153cd517e13bf123.js" defer></script><script src="polyfills.b74d595cc9766a139c5a.js" defer></script><script src="main.dbfd61e5de2ba290d04a.js" defer></script>
</body></html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +0,0 @@
(()=>{"use strict";var e,r,t,a={},o={};function n(e){var r=o[e];if(void 0!==r)return r.exports;var t=o[e]={id:e,loaded:!1,exports:{}};return a[e].call(t.exports,t,t.exports,n),t.loaded=!0,t.exports}n.m=a,e=[],n.O=(r,t,a,o)=>{if(!t){var l=1/0;for(s=0;s<e.length;s++){for(var[t,a,o]=e[s],d=!0,i=0;i<t.length;i++)(!1&o||l>=o)&&Object.keys(n.O).every(e=>n.O[e](t[i]))?t.splice(i--,1):(d=!1,o<l&&(l=o));d&&(e.splice(s--,1),r=a())}return r}o=o||0;for(var s=e.length;s>0&&e[s-1][2]>o;s--)e[s]=e[s-1];e[s]=[t,a,o]},n.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return n.d(r,{a:r}),r},n.d=(e,r)=>{for(var t in r)n.o(r,t)&&!n.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},n.f={},n.e=e=>Promise.all(Object.keys(n.f).reduce((r,t)=>(n.f[t](e,r),r),[])),n.u=e=>e+"."+{432:"635dd65c825f8e4ca25b",646:"4d1e1dc02d21b483a9c9",891:"65e70a7da1bfef9d82e4",958:"9a3ae49eb9fc6ea729f7"}[e]+".js",n.miniCssF=e=>"styles.97554e699a42acff6579.css",n.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),r={},t="rtl:",n.l=(e,a,o,l)=>{if(r[e])r[e].push(a);else{var d,i;if(void 0!==o)for(var s=document.getElementsByTagName("script"),u=0;u<s.length;u++){var c=s[u];if(c.getAttribute("src")==e||c.getAttribute("data-webpack")==t+o){d=c;break}}d||(i=!0,(d=document.createElement("script")).charset="utf-8",d.timeout=120,n.nc&&d.setAttribute("nonce",n.nc),d.setAttribute("data-webpack",t+o),d.src=e),r[e]=[a];var f=(t,a)=>{d.onerror=d.onload=null,clearTimeout(p);var o=r[e];if(delete r[e],d.parentNode&&d.parentNode.removeChild(d),o&&o.forEach(e=>e(a)),t)return t(a)},p=setTimeout(f.bind(null,void 0,{type:"timeout",target:d}),12e4);d.onerror=f.bind(null,d.onerror),d.onload=f.bind(null,d.onload),i&&document.head.appendChild(d)}},n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),n.p="",(()=>{var e={666:0};n.f.j=(r,t)=>{var a=n.o(e,r)?e[r]:void 0;if(0!==a)if(a)t.push(a[2]);else if(666!=r){var o=new Promise((t,o)=>a=e[r]=[t,o]);t.push(a[2]=o);var l=n.p+n.u(r),d=new Error;n.l(l,t=>{if(n.o(e,r)&&(0!==(a=e[r])&&(e[r]=void 0),a)){var o=t&&("load"===t.type?"missing":t.type),l=t&&t.target&&t.target.src;d.message="Loading chunk "+r+" failed.\n("+o+": "+l+")",d.name="ChunkLoadError",d.type=o,d.request=l,a[1](d)}},"chunk-"+r,r)}else e[r]=0},n.O.j=r=>0===e[r];var r=(r,t)=>{var a,o,[l,d,i]=t,s=0;for(a in d)n.o(d,a)&&(n.m[a]=d[a]);if(i)var u=i(n);for(r&&r(t);s<l.length;s++)n.o(e,o=l[s])&&e[o]&&e[o][0](),e[l[s]]=0;return n.O(u)},t=self.webpackChunkrtl=self.webpackChunkrtl||[];t.forEach(r.bind(null,0)),t.push=r.bind(null,t.push.bind(t))})()})();

View File

@ -0,0 +1 @@
(()=>{"use strict";var e,r,t,o={},a={};function n(e){var r=a[e];if(void 0!==r)return r.exports;var t=a[e]={id:e,loaded:!1,exports:{}};return o[e].call(t.exports,t,t.exports,n),t.loaded=!0,t.exports}n.m=o,e=[],n.O=(r,t,o,a)=>{if(!t){var l=1/0;for(s=0;s<e.length;s++){for(var[t,o,a]=e[s],d=!0,i=0;i<t.length;i++)(!1&a||l>=a)&&Object.keys(n.O).every(e=>n.O[e](t[i]))?t.splice(i--,1):(d=!1,a<l&&(l=a));d&&(e.splice(s--,1),r=o())}return r}a=a||0;for(var s=e.length;s>0&&e[s-1][2]>a;s--)e[s]=e[s-1];e[s]=[t,o,a]},n.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return n.d(r,{a:r}),r},n.d=(e,r)=>{for(var t in r)n.o(r,t)&&!n.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},n.f={},n.e=e=>Promise.all(Object.keys(n.f).reduce((r,t)=>(n.f[t](e,r),r),[])),n.u=e=>e+"."+{432:"445cefaea6e55b1bdab0",646:"2c1c2f3edf7874221ff7",891:"6dd272dbd3f8361df2c6",958:"e0bf2387659fbfe0f2be"}[e]+".js",n.miniCssF=e=>"styles.97554e699a42acff6579.css",n.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),r={},t="rtl:",n.l=(e,o,a,l)=>{if(r[e])r[e].push(o);else{var d,i;if(void 0!==a)for(var s=document.getElementsByTagName("script"),u=0;u<s.length;u++){var f=s[u];if(f.getAttribute("src")==e||f.getAttribute("data-webpack")==t+a){d=f;break}}d||(i=!0,(d=document.createElement("script")).charset="utf-8",d.timeout=120,n.nc&&d.setAttribute("nonce",n.nc),d.setAttribute("data-webpack",t+a),d.src=e),r[e]=[o];var c=(t,o)=>{d.onerror=d.onload=null,clearTimeout(p);var a=r[e];if(delete r[e],d.parentNode&&d.parentNode.removeChild(d),a&&a.forEach(e=>e(o)),t)return t(o)},p=setTimeout(c.bind(null,void 0,{type:"timeout",target:d}),12e4);d.onerror=c.bind(null,d.onerror),d.onload=c.bind(null,d.onload),i&&document.head.appendChild(d)}},n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),n.p="",(()=>{var e={666:0};n.f.j=(r,t)=>{var o=n.o(e,r)?e[r]:void 0;if(0!==o)if(o)t.push(o[2]);else if(666!=r){var a=new Promise((t,a)=>o=e[r]=[t,a]);t.push(o[2]=a);var l=n.p+n.u(r),d=new Error;n.l(l,t=>{if(n.o(e,r)&&(0!==(o=e[r])&&(e[r]=void 0),o)){var a=t&&("load"===t.type?"missing":t.type),l=t&&t.target&&t.target.src;d.message="Loading chunk "+r+" failed.\n("+a+": "+l+")",d.name="ChunkLoadError",d.type=a,d.request=l,o[1](d)}},"chunk-"+r,r)}else e[r]=0},n.O.j=r=>0===e[r];var r=(r,t)=>{var o,a,[l,d,i]=t,s=0;for(o in d)n.o(d,o)&&(n.m[o]=d[o]);if(i)var u=i(n);for(r&&r(t);s<l.length;s++)n.o(e,a=l[s])&&e[a]&&e[a][0](),e[l[s]]=0;return n.O(u)},t=self.webpackChunkrtl=self.webpackChunkrtl||[];t.forEach(r.bind(null,0)),t.push=r.bind(null,t.push.bind(t))})()})();

View File

@ -119,7 +119,6 @@ exports.getSentPaymentsInformation = (req, res, next) => {
let paymentsArr = req.body.payments.split(',');
return Promise.all(paymentsArr.map(payment => {return getSentInfoFromPaymentRequest(payment)}))
.then(function(values) {
console.warn(values);
logger.log({level: 'DEBUG', fileName: 'Payments', msg: 'Payment Sent Informations', data: values});
logger.log({level: 'INFO', fileName: 'Payments', msg: 'Sent Payment Information Received'});
res.status(200).json(values);

View File

@ -1,37 +0,0 @@
// @ts-check
// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts
const { SpecReporter, StacktraceOption } = require('jasmine-spec-reporter');
/**
* @type { import("protractor").Config }
*/
exports.config = {
allScriptsTimeout: 11000,
specs: [
'./src/**/*.e2e-spec.ts'
],
capabilities: {
browserName: 'chrome'
},
directConnect: true,
SELENIUM_PROMISE_MANAGER: false,
baseUrl: 'http://localhost:4200/',
framework: 'jasmine',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
print: function() {}
},
onPrepare() {
require('ts-node').register({
project: require('path').join(__dirname, './tsconfig.json')
});
jasmine.getEnv().addReporter(new SpecReporter({
spec: {
displayStacktrace: StacktraceOption.PRETTY
}
}));
}
};

View File

@ -1,23 +0,0 @@
import { AppPage } from './app.po';
import { browser, logging } from 'protractor';
describe('workspace-project App', () => {
let page: AppPage;
beforeEach(() => {
page = new AppPage();
});
it('should display welcome message', async () => {
await page.navigateTo();
expect(await page.getTitleText()).toEqual('RTL app is running!');
});
afterEach(async () => {
// Assert that there are no errors emitted from the browser
const logs = await browser.manage().logs().get(logging.Type.BROWSER);
expect(logs).not.toContain(jasmine.objectContaining({
level: logging.Level.SEVERE,
} as logging.Entry));
});
});

View File

@ -1,11 +0,0 @@
import { browser, by, element } from 'protractor';
export class AppPage {
async navigateTo(): Promise<unknown> {
return browser.get(browser.baseUrl);
}
async getTitleText(): Promise<string> {
return element(by.css('app-root .content span')).getText();
}
}

View File

@ -1,13 +0,0 @@
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/e2e",
"module": "commonjs",
"target": "es2018",
"types": [
"jasmine",
"node"
]
}
}

View File

@ -7,12 +7,9 @@
"start": "ng serve --open",
"prebuild": "node ./src/prebuild",
"build": "ng analytics off && ng lint && ng build --configuration production",
"devbuild": "ng build --configuration production",
"serve": "ng serve",
"server": "set NODE_ENV=development&&nodemon ./rtl.js",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"postinstall": "ngcc"
},
"private": true,

View File

@ -42,7 +42,7 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
public flgLoggedIn = false;
unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject(), new Subject(), new Subject(), new Subject()];
constructor(private logger: LoggerService, private commonService: CommonService, private store: Store<fromRTLReducer.RTLState>, private actions$: Actions,
constructor(private logger: LoggerService, private commonService: CommonService, private store: Store<fromRTLReducer.RTLState>, private actions: Actions,
private userIdle: UserIdleService, private router: Router, private sessionService: SessionService, private breakpointObserver: BreakpointObserver, private renderer: Renderer2) {}
ngOnInit() {
@ -92,7 +92,7 @@ export class AppComponent implements OnInit, AfterViewInit, OnDestroy {
if (this.sessionService.getItem('defaultPassword') === 'true') {
this.flgSideNavOpened = false;
}
this.actions$.pipe(takeUntil(this.unSubs[2]),
this.actions.pipe(takeUntil(this.unSubs[2]),
filter((action) => action.type === RTLActions.SET_RTL_CONFIG || action.type === RTLActions.LOGOUT))
.subscribe((action: (RTLActions.SetRTLConfig | RTLActions.Logout)) => {
if (action.type === RTLActions.SET_RTL_CONFIG) {

View File

@ -1,4 +1,4 @@
import { BrowserModule, HammerModule } from '@angular/platform-browser';
import { HammerModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { HTTP_INTERCEPTORS } from '@angular/common/http';
@ -30,7 +30,6 @@ import { LayoutModule } from '@angular/cdk/layout';
@NgModule({
imports: [
BrowserModule,
BrowserAnimationsModule,
SharedModule,
routing,

View File

@ -1,4 +1,5 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { SharedModule } from '../../../shared/shared.module';
import { CLBalancesInfoComponent } from './balances-info.component';
@ -6,9 +7,10 @@ describe('CLBalancesInfoComponent', () => {
let component: CLBalancesInfoComponent;
let fixture: ComponentFixture<CLBalancesInfoComponent>;
beforeEach(async(() => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ CLBalancesInfoComponent ]
declarations: [ CLBalancesInfoComponent ],
imports: [ SharedModule ]
})
.compileComponents();
}));
@ -22,4 +24,9 @@ describe('CLBalancesInfoComponent', () => {
it('should create', () => {
expect(component).toBeTruthy();
});
afterEach(() => {
TestBed.resetTestingModule();
});
});

View File

@ -2,14 +2,14 @@
<div fxLayout="column" fxFlex="9" fxLayoutAlign="end start">
<span class="dashboard-capacity-header this-channel-capacity">Total Capacity</span>
<div fxLayout="row" fxLayoutAlign="space-between start" class="w-100">
<mat-hint fxFlex="40" fxLayoutAlign="start center" class="font-size-90"><strong class="font-weight-900 mr-5px">Local:</strong>{{channelBalances.localBalance || 0 | number:'1.0-0'}} Sats</mat-hint>
<mat-hint fxFlex="40" fxLayoutAlign="start center" class="font-size-90"><strong class="font-weight-900 mr-5px">Local:</strong>{{channelBalances?.localBalance || 0 | number:'1.0-0'}} Sats</mat-hint>
<mat-hint fxFlex="20" fxLayoutAlign="center center" class="font-size-90">
<fa-icon [icon]="faBalanceScale" class="mr-3px" matTooltip="Balance Score"></fa-icon>
({{channelBalances?.balancedness || 0 | number}})
</mat-hint>
<mat-hint fxFlex="40" fxLayoutAlign="end center" class="font-size-90"><strong class="font-weight-900 mr-5px">Remote:</strong>{{channelBalances.remoteBalance || 0 | number:'1.0-0'}} Sats</mat-hint>
<mat-hint fxFlex="40" fxLayoutAlign="end center" class="font-size-90"><strong class="font-weight-900 mr-5px">Remote:</strong>{{channelBalances?.remoteBalance || 0 | number:'1.0-0'}} Sats</mat-hint>
</div>
<mat-progress-bar class="dashboard-progress-bar this-channel-bar" mode="determinate" color="accent" value="{{channelBalances.localBalance && channelBalances.localBalance > 0 ? ((+channelBalances.localBalance/((+channelBalances.localBalance)+(+channelBalances.remoteBalance)))*100) : 0}}"></mat-progress-bar>
<mat-progress-bar class="dashboard-progress-bar this-channel-bar" mode="determinate" color="accent" value="{{channelBalances?.localBalance && channelBalances?.localBalance > 0 ? ((+channelBalances?.localBalance/((+channelBalances?.localBalance)+(+channelBalances?.remoteBalance)))*100) : 0}}"></mat-progress-bar>
</div>
<div fxLayout="column" fxFlex="3" fxLayoutAlign="end stretch"><mat-divider class="dashboard-divider"></mat-divider></div>
<div class="channels-capacity-scroll" [perfectScrollbar]>

View File

@ -1,4 +1,6 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { SharedModule } from '../../../shared/shared.module';
import { CLChannelCapacityInfoComponent } from './channel-capacity-info.component';
@ -6,9 +8,10 @@ describe('CLChannelCapacityInfoComponent', () => {
let component: CLChannelCapacityInfoComponent;
let fixture: ComponentFixture<CLChannelCapacityInfoComponent>;
beforeEach(async(() => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ CLChannelCapacityInfoComponent ]
declarations: [ CLChannelCapacityInfoComponent ],
imports: [ SharedModule, RouterTestingModule ]
})
.compileComponents();
}));
@ -22,4 +25,9 @@ describe('CLChannelCapacityInfoComponent', () => {
it('should create', () => {
expect(component).toBeTruthy();
});
afterEach(() => {
TestBed.resetTestingModule();
});
});

View File

@ -1,14 +1,24 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { SharedModule } from '../../../shared/shared.module';
import { CommonService } from '../../../shared/services/common.service';
import { mockCommonService } from '../../../shared/services/test-consts';
import { CLChannelLiquidityInfoComponent } from './channel-liquidity-info.component';
describe('CLChannelLiquidityInfoComponent', () => {
let component: CLChannelLiquidityInfoComponent;
let component: CLChannelLiquidityInfoComponent;
let commonService: CommonService;
let fixture: ComponentFixture<CLChannelLiquidityInfoComponent>;
beforeEach(async(() => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ CLChannelLiquidityInfoComponent ]
declarations: [ CLChannelLiquidityInfoComponent ],
imports: [ SharedModule, RouterTestingModule ],
providers: [
{ provide: CommonService, useClass: mockCommonService }
]
})
.compileComponents();
}));
@ -16,10 +26,15 @@ describe('CLChannelLiquidityInfoComponent', () => {
beforeEach(() => {
fixture = TestBed.createComponent(CLChannelLiquidityInfoComponent);
component = fixture.componentInstance;
commonService = TestBed.inject<CommonService>(CommonService);
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
it('should create common service', () => {
expect(commonService).toBeTruthy();
});
});

View File

@ -1,28 +1,28 @@
<div fxLayout="column" fxFlex="50" fxLayoutAlign="space-between stretch">
<div>
<h4 fxLayoutAlign="start" class="dashboard-info-title">Active</h4>
<div class="overflow-wrap dashboard-info-value"><span class="dot tiny-dot green"></span>{{(channelsStatus.active.channels || 0) | number}}</div>
<div class="overflow-wrap dashboard-info-value"><span class="dot tiny-dot green"></span>{{(channelsStatus?.active?.channels || 0) | number}}</div>
</div>
<div>
<h4 fxLayoutAlign="start" class="dashboard-info-title">Pending</h4>
<div class="overflow-wrap dashboard-info-value"><span class="dot tiny-dot yellow"></span>{{(channelsStatus.pending.channels || 0) | number}}</div>
<div class="overflow-wrap dashboard-info-value"><span class="dot tiny-dot yellow"></span>{{(channelsStatus?.pending?.channels || 0) | number}}</div>
</div>
<div>
<h4 fxLayoutAlign="start" class="dashboard-info-title">Inactive</h4>
<div class="overflow-wrap dashboard-info-value"><span class="dot tiny-dot grey"></span>{{(channelsStatus.inactive.channels || 0) | number}}</div>
<div class="overflow-wrap dashboard-info-value"><span class="dot tiny-dot grey"></span>{{(channelsStatus?.inactive?.channels || 0) | number}}</div>
</div>
</div>
<div fxLayout="column" fxFlex="50" fxLayoutAlign="space-between stretch">
<div>
<h4 fxLayoutAlign="start" class="dashboard-info-title">Capacity</h4>
<div class="overflow-wrap dashboard-info-value">{{(channelsStatus.active.capacity || 0) | number}} Sats</div>
<div class="overflow-wrap dashboard-info-value">{{(channelsStatus?.active?.capacity || 0) | number}} Sats</div>
</div>
<div>
<h4 fxLayoutAlign="start" class="dashboard-info-title">Capacity</h4>
<div class="overflow-wrap dashboard-info-value">{{(channelsStatus.pending.capacity || 0) | number}} Sats</div>
<div class="overflow-wrap dashboard-info-value">{{(channelsStatus?.pending?.capacity || 0) | number}} Sats</div>
</div>
<div>
<h4 fxLayoutAlign="start" class="dashboard-info-title">Capacity</h4>
<div class="overflow-wrap dashboard-info-value">{{(channelsStatus.inactive.capacity || 0) | number}} Sats</div>
<div class="overflow-wrap dashboard-info-value">{{(channelsStatus?.inactive?.capacity || 0) | number}} Sats</div>
</div>
</div>

View File

@ -1,4 +1,5 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { SharedModule } from '../../../shared/shared.module';
import { CLChannelStatusInfoComponent } from './channel-status-info.component';
@ -6,9 +7,10 @@ describe('CLChannelStatusInfoComponent', () => {
let component: CLChannelStatusInfoComponent;
let fixture: ComponentFixture<CLChannelStatusInfoComponent>;
beforeEach(async(() => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ CLChannelStatusInfoComponent ]
declarations: [ CLChannelStatusInfoComponent ],
imports: [ SharedModule ]
})
.compileComponents();
}));
@ -22,4 +24,9 @@ describe('CLChannelStatusInfoComponent', () => {
it('should create', () => {
expect(component).toBeTruthy();
});
afterEach(() => {
TestBed.resetTestingModule();
});
});

View File

@ -1,4 +1,5 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { SharedModule } from '../../../shared/shared.module';
import { CLFeeInfoComponent } from './fee-info.component';
@ -6,9 +7,10 @@ describe('CLFeeInfoComponent', () => {
let component: CLFeeInfoComponent;
let fixture: ComponentFixture<CLFeeInfoComponent>;
beforeEach(async(() => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ CLFeeInfoComponent ]
declarations: [ CLFeeInfoComponent ],
imports: [ SharedModule ]
})
.compileComponents();
}));
@ -22,4 +24,9 @@ describe('CLFeeInfoComponent', () => {
it('should create', () => {
expect(component).toBeTruthy();
});
afterEach(() => {
TestBed.resetTestingModule();
});
});

View File

@ -1,14 +1,48 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { RouterTestingModule } from "@angular/router/testing";
import { StoreModule } from '@ngrx/store';
import { EffectsModule } from '@ngrx/effects';
import { SharedModule } from '../../shared/shared.module';
import { CommonService } from '../../shared/services/common.service';
import { LoggerService } from '../../shared/services/logger.service';
import { mockCLEffects, mockCommonService, mockECLEffects, mockLNDEffects, mockRTLEffects } from '../../shared/services/test-consts';
import { RTLReducer } from '../../store/rtl.reducers';
import { CLHomeComponent } from './home.component';
import { CLNodeInfoComponent } from './node-info/node-info.component';
import { CLBalancesInfoComponent } from './balances-info/balances-info.component';
import { CLChannelCapacityInfoComponent } from './channel-capacity-info/channel-capacity-info.component';
import { CLChannelStatusInfoComponent } from './channel-status-info/channel-status-info.component';
import { CLFeeInfoComponent } from './fee-info/fee-info.component';
import { ECLEffects } from '../../eclair/store/ecl.effects';
import { CLEffects } from '../store/cl.effects';
import { LNDEffects } from '../../lnd/store/lnd.effects';
import { RTLEffects } from '../../store/rtl.effects';
describe('CLHomeComponent', () => {
let component: CLHomeComponent;
let fixture: ComponentFixture<CLHomeComponent>;
beforeEach(async(() => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ CLHomeComponent ]
declarations: [ CLHomeComponent, CLNodeInfoComponent, CLBalancesInfoComponent, CLChannelCapacityInfoComponent, CLChannelStatusInfoComponent, CLFeeInfoComponent ],
imports: [
SharedModule,
RouterTestingModule,
StoreModule.forRoot(RTLReducer, {
runtimeChecks: {
strictStateImmutability: false,
strictActionImmutability: false
}
}),
EffectsModule.forRoot([mockRTLEffects, mockLNDEffects, mockCLEffects, mockECLEffects])
],
providers: [
LoggerService,
{ provide: CommonService, useClass: mockCommonService }
]
})
.compileComponents();
}));
@ -22,4 +56,9 @@ describe('CLHomeComponent', () => {
it('should create', () => {
expect(component).toBeTruthy();
});
afterEach(() => {
TestBed.resetTestingModule();
});
});

View File

@ -55,7 +55,7 @@ export class CLHomeComponent implements OnInit, OnDestroy {
public flgLoading: Array<Boolean | 'error'> = [true, true, true, true, true, true, true, true]; // 0: Info, 1: Fee, 2: Wallet, 3: Channel, 4: Network
private unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject()];
constructor(private logger: LoggerService, private store: Store<fromRTLReducer.RTLState>, private actions$: Actions, private commonService: CommonService, private router: Router) {
constructor(private logger: LoggerService, private store: Store<fromRTLReducer.RTLState>, private actions: Actions, private commonService: CommonService, private router: Router) {
this.screenSize = this.commonService.getScreenSize();
if(this.screenSize === ScreenSizeEnum.XS) {
this.operatorCards = [
@ -171,9 +171,9 @@ export class CLHomeComponent implements OnInit, OnDestroy {
this.totalInboundLiquidity = 0;
this.totalOutboundLiquidity = 0;
this.allChannels = rtlStore.allChannels.filter(channel => channel.state === 'CHANNELD_NORMAL' && channel.connected);
this.allChannelsCapacity = JSON.parse(JSON.stringify(this.commonService.sortDescByKey(this.allChannels, 'balancedness')));
this.allInboundChannels = JSON.parse(JSON.stringify(this.commonService.sortDescByKey(this.allChannels.filter(channel => channel.msatoshi_to_them > 0), 'msatoshi_to_them')));
this.allOutboundChannels = JSON.parse(JSON.stringify(this.commonService.sortDescByKey(this.allChannels.filter(channel => channel.msatoshi_to_us > 0), 'msatoshi_to_us')));
this.allChannelsCapacity = this.allChannels.length > 0 ? JSON.parse(JSON.stringify(this.commonService.sortDescByKey(this.allChannels, 'balancedness'))) : [];
this.allInboundChannels = this.allChannels.length > 0 ? JSON.parse(JSON.stringify(this.commonService.sortDescByKey(this.allChannels.filter(channel => channel.msatoshi_to_them > 0), 'msatoshi_to_them'))) : [];
this.allOutboundChannels = this.allChannels.length > 0 ? JSON.parse(JSON.stringify(this.commonService.sortDescByKey(this.allChannels.filter(channel => channel.msatoshi_to_us > 0), 'msatoshi_to_us'))) : [];
this.allChannels.forEach(channel => {
this.totalInboundLiquidity = this.totalInboundLiquidity + Math.ceil(channel.msatoshi_to_them/1000);
this.totalOutboundLiquidity = this.totalOutboundLiquidity + Math.floor(channel.msatoshi_to_us/1000);
@ -188,7 +188,7 @@ export class CLHomeComponent implements OnInit, OnDestroy {
}
this.logger.info(rtlStore);
});
this.actions$.pipe(takeUntil(this.unSubs[2]),
this.actions.pipe(takeUntil(this.unSubs[2]),
filter((action) => action.type === CLActions.FETCH_FEES_CL || action.type === CLActions.SET_FEES_CL))
.subscribe(action => {
if(action.type === CLActions.FETCH_FEES_CL) {
@ -214,7 +214,7 @@ export class CLHomeComponent implements OnInit, OnDestroy {
});
} else {
this.sortField = 'Balance Score';
this.allChannelsCapacity = JSON.parse(JSON.stringify(this.commonService.sortDescByKey(this.allChannels, 'balancedness')));
this.allChannelsCapacity = this.allChannels.length > 0 ? JSON.parse(JSON.stringify(this.commonService.sortDescByKey(this.allChannels, 'balancedness'))) : [];
}
}

View File

@ -2,20 +2,20 @@
<div>
<h4 class="dashboard-info-title">Alias</h4>
<div class="overflow-wrap dashboard-info-value">
{{information.alias}}
<span *ngIf="!showColorFieldSeparately" class="dashboard-node-dot dot" [ngStyle]="{'backgroundColor': '#' + information.color}"></span>
{{information?.alias}}
<span *ngIf="!showColorFieldSeparately" class="dashboard-node-dot dot" [ngStyle]="{'backgroundColor': '#' + information?.color}"></span>
</div>
</div>
<div *ngIf="showColorFieldSeparately">
<h4 class="dashboard-info-title">Color</h4>
<div class="overflow-wrap dashboard-info-value">
<span class="dashboard-node-square" [ngStyle]="{'backgroundColor': '#' + information.color}"></span>
{{information.color | uppercase}}
<span class="dashboard-node-square" [ngStyle]="{'backgroundColor': '#' + information?.color}"></span>
{{information?.color | uppercase}}
</div>
</div>
<div>
<h4 class="dashboard-info-title">Implementation</h4>
<div class="overflow-wrap dashboard-info-value">{{(information.lnImplementation || information.version) ? information.lnImplementation + ' ' + information.version : ''}}</div>
<div class="overflow-wrap dashboard-info-value">{{(information?.lnImplementation || information?.version) ? information?.lnImplementation + ' ' + information?.version : ''}}</div>
</div>
<div>
<h4 class="dashboard-info-title">Chain</h4>

View File

@ -1,20 +1,22 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { SharedModule } from '../../../shared/shared.module';
import { CommonService } from '../../../shared/services/common.service';
import { mockCommonService } from '../../../shared/services/test-consts';
import { CLNodeInfoComponent } from './node-info.component';
import { CommonService } from '../../../shared/services/common.service';
describe('CLNodeInfoComponent', () => {
let component: CLNodeInfoComponent;
let fixture: ComponentFixture<CLNodeInfoComponent>;
const mockCommonService = jasmine.createSpyObj("CommonService",["getScreenSize","setScreenSize",
"sortDescByKey","camelCase","titleCase","convertCurrency","convertWithoutFiat","convertWithFiat",
"convertTime","convertTimestampToDate","downloadFile","convertToCSV"]);
let commonService: CommonService;
beforeEach(async(() => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ CLNodeInfoComponent ],
providers: [
{ provide: CommonService, useValue: mockCommonService }
imports: [ SharedModule ],
providers: [
{ provide: CommonService, useClass: mockCommonService }
]
})
.compileComponents();
@ -22,6 +24,7 @@ describe('CLNodeInfoComponent', () => {
beforeEach(() => {
fixture = TestBed.createComponent(CLNodeInfoComponent);
commonService = TestBed.inject(CommonService);
component = fixture.componentInstance;
fixture.detectChanges();
});
@ -29,4 +32,9 @@ describe('CLNodeInfoComponent', () => {
it('should create', () => {
expect(component).toBeTruthy();
});
afterEach(() => {
TestBed.resetTestingModule();
});
});

View File

@ -9,77 +9,77 @@
<mat-divider [inset]="true"></mat-divider>
<div fxLayout="column" fxFlex="20" class="my-1">
<h4 class="font-bold-500">Short Channel Id</h4>
<span class="foreground-secondary-text">{{lookupResult[0].short_channel_id}}</span>
<span class="foreground-secondary-text">{{lookupResult[0]?.short_channel_id}}</span>
</div>
<mat-divider [inset]="true"></mat-divider>
<div fxLayout="column" fxFlex="10" class="my-1">
<h4 class="font-bold-500">Active</h4>
<span class="foreground-secondary-text">{{lookupResult[0].active ? 'True' : 'False'}}</span>
<span class="foreground-secondary-text">{{lookupResult[0]?.active ? 'True' : 'False'}}</span>
</div>
<mat-divider [inset]="true"></mat-divider>
<div fxLayout="column" fxFlex="10" class="my-1">
<h4 class="font-bold-500">Last Update</h4>
<span class="foreground-secondary-text">{{lookupResult[0].last_update }}</span>
<span class="foreground-secondary-text">{{lookupResult[0]?.last_update }}</span>
</div>
<mat-divider [inset]="true"></mat-divider>
<div fxLayout="column" fxFlex="10" class="my-1">
<h4 class="font-bold-500">Amount (mSats)</h4>
<span class="foreground-secondary-text">{{lookupResult[0].amount_msat}}</span>
<span class="foreground-secondary-text">{{lookupResult[0]?.amount_msat}}</span>
</div>
<mat-divider [inset]="true"></mat-divider>
<div fxLayout="column" fxFlex="10" class="my-1">
<h4 class="font-bold-500">Base Fee (mSats)</h4>
<span class="foreground-secondary-text">{{lookupResult[0].base_fee_millisatoshi | number}}</span>
<span class="foreground-secondary-text">{{lookupResult[0]?.base_fee_millisatoshi | number}}</span>
</div>
<mat-divider [inset]="true"></mat-divider>
<div fxLayout="column" fxFlex="10" class="my-1">
<h4 class="font-bold-500">Channel Flags</h4>
<span class="foreground-secondary-text">{{lookupResult[0].channel_flags | number}}</span>
<span class="foreground-secondary-text">{{lookupResult[0]?.channel_flags | number}}</span>
</div>
<mat-divider [inset]="true"></mat-divider>
<div fxLayout="column" fxFlex="10" class="my-1">
<h4 class="font-bold-500">Delay</h4>
<span class="foreground-secondary-text">{{lookupResult[0].delay | number}}</span>
<span class="foreground-secondary-text">{{lookupResult[0]?.delay | number}}</span>
</div>
<mat-divider [inset]="true"></mat-divider>
<div fxLayout="column" fxFlex="10" class="my-1">
<h4 class="font-bold-500">Destination</h4>
<span class="foreground-secondary-text">{{lookupResult[0].destination}}</span>
<span class="foreground-secondary-text">{{lookupResult[0]?.destination}}</span>
</div>
<mat-divider [inset]="true"></mat-divider>
<div fxLayout="column" fxFlex="10" class="my-1">
<h4 class="font-bold-500">Fee/Millionth</h4>
<span class="foreground-secondary-text">{{lookupResult[0].fee_per_millionth | number}}</span>
<span class="foreground-secondary-text">{{lookupResult[0]?.fee_per_millionth | number}}</span>
</div>
<mat-divider [inset]="true"></mat-divider>
<div fxLayout="column" fxFlex="10" class="my-1">
<h4 class="font-bold-500">Max Htlc (mSat)</h4>
<span class="foreground-secondary-text">{{lookupResult[0].htlc_maximum_msat}}</span>
<span class="foreground-secondary-text">{{lookupResult[0]?.htlc_maximum_msat}}</span>
</div>
<mat-divider [inset]="true"></mat-divider>
<div fxLayout="column" fxFlex="10" class="my-1">
<h4 class="font-bold-500">Min Htlc (mSat)</h4>
<span class="foreground-secondary-text">{{lookupResult[0].htlc_minimum_msat}}</span>
<span class="foreground-secondary-text">{{lookupResult[0]?.htlc_minimum_msat}}</span>
</div>
<mat-divider [inset]="true"></mat-divider>
<div fxLayout="column" fxFlex="10" class="my-1">
<h4 class="font-bold-500">Message Flags</h4>
<span class="foreground-secondary-text">{{lookupResult[0].message_flags | number}}</span>
<span class="foreground-secondary-text">{{lookupResult[0]?.message_flags | number}}</span>
</div>
<mat-divider [inset]="true"></mat-divider>
<div fxLayout="column" fxFlex="10" class="my-1">
<h4 class="font-bold-500">Public</h4>
<span class="foreground-secondary-text">{{lookupResult[0].public ? 'Yes' : 'No'}}</span>
<span class="foreground-secondary-text">{{lookupResult[0]?.public ? 'Yes' : 'No'}}</span>
</div>
<mat-divider [inset]="true"></mat-divider>
<div fxLayout="column" fxFlex="10" class="my-1">
<h4 class="font-bold-500">Satoshis</h4>
<span class="foreground-secondary-text">{{lookupResult[0].satoshis | number}}</span>
<span class="foreground-secondary-text">{{lookupResult[0]?.satoshis | number}}</span>
</div>
<mat-divider [inset]="true"></mat-divider>
<div fxLayout="column" fxFlex="10" class="my-1">
<h4 class="font-bold-500">Source</h4>
<span class="foreground-secondary-text">{{lookupResult[0].source}}</span>
<span class="foreground-secondary-text">{{lookupResult[0]?.source}}</span>
</div>
</div>
<div fxLayout="column" fxFlex="49" fxLayoutAlign="start start" class="mt-1 bordered-box padding-gap-large">
@ -90,77 +90,77 @@
<mat-divider [inset]="true"></mat-divider>
<div fxLayout="column" fxFlex="20" class="my-1">
<h4 class="font-bold-500">Short Channel Id</h4>
<span class="foreground-secondary-text">{{lookupResult[1].short_channel_id}}</span>
<span class="foreground-secondary-text">{{lookupResult[1]?.short_channel_id}}</span>
</div>
<mat-divider [inset]="true"></mat-divider>
<div fxLayout="column" fxFlex="10" class="my-1">
<h4 class="font-bold-500">Active</h4>
<span class="foreground-secondary-text">{{lookupResult[1].active ? 'True' : 'False'}}</span>
<span class="foreground-secondary-text">{{lookupResult[1]?.active ? 'True' : 'False'}}</span>
</div>
<mat-divider [inset]="true"></mat-divider>
<div fxLayout="column" fxFlex="10" class="my-1">
<h4 class="font-bold-500">Last Update</h4>
<span class="foreground-secondary-text">{{(lookupResult[1].last_update * 1000) | date:'dd/MMM/YYYY HH:mm'}}</span>
<span class="foreground-secondary-text">{{(lookupResult[1]?.last_update * 1000) | date:'dd/MMM/YYYY HH:mm'}}</span>
</div>
<mat-divider [inset]="true"></mat-divider>
<div fxLayout="column" fxFlex="10" class="my-1">
<h4 class="font-bold-500">Amount (mSats)</h4>
<span class="foreground-secondary-text">{{lookupResult[1].amount_msat}}</span>
<span class="foreground-secondary-text">{{lookupResult[1]?.amount_msat}}</span>
</div>
<mat-divider [inset]="true"></mat-divider>
<div fxLayout="column" fxFlex="10" class="my-1">
<h4 class="font-bold-500">Base Fee (mSats)</h4>
<span class="foreground-secondary-text">{{lookupResult[1].base_fee_millisatoshi | number}}</span>
<span class="foreground-secondary-text">{{lookupResult[1]?.base_fee_millisatoshi | number}}</span>
</div>
<mat-divider [inset]="true"></mat-divider>
<div fxLayout="column" fxFlex="10" class="my-1">
<h4 class="font-bold-500">Channel Flags</h4>
<span class="foreground-secondary-text">{{lookupResult[1].channel_flags | number}}</span>
<span class="foreground-secondary-text">{{lookupResult[1]?.channel_flags | number}}</span>
</div>
<mat-divider [inset]="true"></mat-divider>
<div fxLayout="column" fxFlex="10" class="my-1">
<h4 class="font-bold-500">Delay</h4>
<span class="foreground-secondary-text">{{lookupResult[1].delay | number}}</span>
<span class="foreground-secondary-text">{{lookupResult[1]?.delay | number}}</span>
</div>
<mat-divider [inset]="true"></mat-divider>
<div fxLayout="column" fxFlex="10" class="my-1">
<h4 class="font-bold-500">Destination</h4>
<span class="foreground-secondary-text">{{lookupResult[1].destination}}</span>
<span class="foreground-secondary-text">{{lookupResult[1]?.destination}}</span>
</div>
<mat-divider [inset]="true"></mat-divider>
<div fxLayout="column" fxFlex="10" class="my-1">
<h4 class="font-bold-500">Fee/Millionth</h4>
<span class="foreground-secondary-text">{{lookupResult[1].fee_per_millionth | number}}</span>
<span class="foreground-secondary-text">{{lookupResult[1]?.fee_per_millionth | number}}</span>
</div>
<mat-divider [inset]="true"></mat-divider>
<div fxLayout="column" fxFlex="10" class="my-1">
<h4 class="font-bold-500">Max Htlc (mSat)</h4>
<span class="foreground-secondary-text">{{lookupResult[1].htlc_maximum_msat}}</span>
<span class="foreground-secondary-text">{{lookupResult[1]?.htlc_maximum_msat}}</span>
</div>
<mat-divider [inset]="true"></mat-divider>
<div fxLayout="column" fxFlex="10" class="my-1">
<h4 class="font-bold-500">Min Htlc (mSat)</h4>
<span class="foreground-secondary-text">{{lookupResult[1].htlc_minimum_msat}}</span>
<span class="foreground-secondary-text">{{lookupResult[1]?.htlc_minimum_msat}}</span>
</div>
<mat-divider [inset]="true"></mat-divider>
<div fxLayout="column" fxFlex="10" class="my-1">
<h4 class="font-bold-500">Message Flags</h4>
<span class="foreground-secondary-text">{{lookupResult[1].message_flags | number}}</span>
<span class="foreground-secondary-text">{{lookupResult[1]?.message_flags | number}}</span>
</div>
<mat-divider [inset]="true"></mat-divider>
<div fxLayout="column" fxFlex="10" class="my-1">
<h4 class="font-bold-500">Public</h4>
<span class="foreground-secondary-text">{{lookupResult[1].public ? 'Yes' : 'No'}}</span>
<span class="foreground-secondary-text">{{lookupResult[1]?.public ? 'Yes' : 'No'}}</span>
</div>
<mat-divider [inset]="true"></mat-divider>
<div fxLayout="column" fxFlex="10" class="my-1">
<h4 class="font-bold-500">Satoshis</h4>
<span class="foreground-secondary-text">{{lookupResult[1].satoshis | number}}</span>
<span class="foreground-secondary-text">{{lookupResult[1]?.satoshis | number}}</span>
</div>
<mat-divider [inset]="true"></mat-divider>
<div fxLayout="column" fxFlex="10" class="my-1">
<h4 class="font-bold-500">Source</h4>
<span class="foreground-secondary-text">{{lookupResult[1].source}}</span>
<span class="foreground-secondary-text">{{lookupResult[1]?.source}}</span>
</div>
</div>
</div>

View File

@ -1,14 +1,26 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { StoreModule } from '@ngrx/store';
import { SharedModule } from '../../../shared/shared.module';
import { RTLReducer } from '../../../store/rtl.reducers';
import { CLChannelLookupComponent } from './channel-lookup.component';
describe('CLChannelLookupComponent', () => {
let component: CLChannelLookupComponent;
let fixture: ComponentFixture<CLChannelLookupComponent>;
beforeEach(async(() => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ CLChannelLookupComponent ]
declarations: [ CLChannelLookupComponent ],
imports: [
SharedModule,
StoreModule.forRoot(RTLReducer, {
runtimeChecks: {
strictStateImmutability: false,
strictActionImmutability: false
}
}),
]
})
.compileComponents();
}));
@ -22,4 +34,9 @@ describe('CLChannelLookupComponent', () => {
it('should create', () => {
expect(component).toBeTruthy();
});
afterEach(() => {
TestBed.resetTestingModule();
});
});

View File

@ -12,7 +12,7 @@ import * as fromRTLReducer from '../../../store/rtl.reducers';
styleUrls: ['./channel-lookup.component.scss']
})
export class CLChannelLookupComponent implements OnInit {
@Input() lookupResult: ChannelEdge[];
@Input() lookupResult: ChannelEdge[] = [];
public node1_match = false;
public node2_match = false;
private unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject(), new Subject()];

View File

@ -1,14 +1,39 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { StoreModule } from '@ngrx/store';
import { CommonService } from '../../shared/services/common.service';
import { LoggerService } from '../../shared/services/logger.service';
import { RTLReducer } from '../../store/rtl.reducers';
import { CLLookupsComponent } from './lookups.component';
import { SharedModule } from '../../shared/shared.module';
import { CLNodeLookupComponent } from './node-lookup/node-lookup.component';
import { CLChannelLookupComponent } from './channel-lookup/channel-lookup.component';
import { mockCLEffects, mockCommonService, mockECLEffects, mockLNDEffects, mockRTLEffects } from '../../shared/services/test-consts';
import { EffectsModule } from '@ngrx/effects';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
describe('CLLookupsComponent', () => {
let component: CLLookupsComponent;
let fixture: ComponentFixture<CLLookupsComponent>;
beforeEach(async(() => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ CLLookupsComponent ]
declarations: [ CLLookupsComponent, CLNodeLookupComponent, CLChannelLookupComponent ],
imports: [
BrowserAnimationsModule,
SharedModule,
StoreModule.forRoot(RTLReducer, {
runtimeChecks: {
strictStateImmutability: false,
strictActionImmutability: false
}
}),
EffectsModule.forRoot([mockRTLEffects, mockLNDEffects, mockCLEffects, mockECLEffects])
],
providers: [
LoggerService,
{ provide: CommonService, useClass: mockCommonService }
]
})
.compileComponents();
}));
@ -22,4 +47,9 @@ describe('CLLookupsComponent', () => {
it('should create', () => {
expect(component).toBeTruthy();
});
afterEach(() => {
TestBed.resetTestingModule();
});
});

View File

@ -37,12 +37,12 @@ export class CLLookupsComponent implements OnInit, OnDestroy {
public screenSizeEnum = ScreenSizeEnum;
private unSubs: Array<Subject<void>> = [new Subject()];
constructor(private logger: LoggerService, private commonService: CommonService, private store: Store<fromRTLReducer.RTLState>, private actions$: Actions) {
constructor(private logger: LoggerService, private commonService: CommonService, private store: Store<fromRTLReducer.RTLState>, private actions: Actions) {
this.screenSize = this.commonService.getScreenSize();
}
ngOnInit() {
this.actions$
this.actions
.pipe(
takeUntil(this.unSubs[0]),
filter((action) => (action.type === CLActions.SET_LOOKUP_CL || action.type === CLActions.EFFECT_ERROR_CL))

View File

@ -2,24 +2,24 @@
<mat-divider [inset]="true" class="mb-1"></mat-divider>
<div fxLayout="column" fxFlex="100" fxLayoutAlign="end start" class="my-1">
<h4 fxLayoutAlign="start" class="font-bold-500">Pub Key</h4>
<span class="foreground-secondary-text w-100">{{lookupResult.nodeid}}</span>
<span class="foreground-secondary-text w-100">{{lookupResult?.nodeid}}</span>
</div>
<mat-divider [inset]="true" class="my-1"></mat-divider>
<div fxLayout="row">
<div fxLayout="column" fxFlex="100" fxLayoutAlign="end start" class="my-1">
<h4 fxLayoutAlign="start" class="font-bold-500">Alias</h4>
<span class="foreground-secondary-text">{{lookupResult.alias}}<span class="ml-2" [ngStyle]="{'background-color': '#' + lookupResult.color}">{{lookupResult.color ? '#' + lookupResult.color : ''}}</span></span>
<span class="foreground-secondary-text">{{lookupResult?.alias}}<span class="ml-2" [ngStyle]="{'background-color': '#' + lookupResult?.color}">{{lookupResult?.color ? '#' + lookupResult?.color : ''}}</span></span>
</div>
</div>
<mat-divider [inset]="true" class="my-1"></mat-divider>
<div fxLayout="row">
<div fxLayout="column" fxFlex="50" fxLayoutAlign="end start" class="my-1">
<h4 fxLayoutAlign="start" class="font-bold-500">Last Update</h4>
<span class="foreground-secondary-text">{{(lookupResult.last_timestamp * 1000) | date:'dd/MMM/YYYY HH:mm'}}</span>
<span class="foreground-secondary-text">{{(lookupResult?.last_timestamp * 1000) | date:'dd/MMM/YYYY HH:mm'}}</span>
</div>
<div fxLayout="column" fxFlex="50" fxLayoutAlign="end start" class="my-1">
<h4 fxLayoutAlign="start" class="font-bold-500">Features</h4>
<span class="foreground-secondary-text">{{lookupResult.features}}</span>
<span class="foreground-secondary-text">{{lookupResult?.features}}</span>
</div>
</div>
<mat-divider [inset]="true" class="my-1"></mat-divider>
@ -43,7 +43,7 @@
<th mat-header-cell *matHeaderCellDef class="pl-1"><span fxLayoutAlign="end center">Actions</span></th>
<td mat-cell *matCellDef="let address" class="pl-1">
<span fxLayoutAlign="end center">
<button mat-stroked-button color="primary" type="button" tabindex="1" rtlClipboard [payload]="lookupResult.nodeid + '@' + address.address + ':' + address.port" (copied)="onCopyNodeURI($event)">Copy Node URI</button>
<button mat-stroked-button color="primary" type="button" tabindex="1" rtlClipboard [payload]="lookupResult?.nodeid + '@' + address.address + ':' + address.port" (copied)="onCopyNodeURI($event)">Copy Node URI</button>
</span>
</td>
</ng-container>

View File

@ -1,4 +1,6 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { LoggerService } from '../../../shared/services/logger.service';
import { SharedModule } from '../../../shared/shared.module';
import { CLNodeLookupComponent } from './node-lookup.component';
@ -6,9 +8,11 @@ describe('CLNodeLookupComponent', () => {
let component: CLNodeLookupComponent;
let fixture: ComponentFixture<CLNodeLookupComponent>;
beforeEach(async(() => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ CLNodeLookupComponent ]
declarations: [ CLNodeLookupComponent ],
imports: [ SharedModule ],
providers: [ LoggerService ]
})
.compileComponents();
}));
@ -22,4 +26,9 @@ describe('CLNodeLookupComponent', () => {
it('should create', () => {
expect(component).toBeTruthy();
});
afterEach(() => {
TestBed.resetTestingModule();
});
});

View File

@ -20,8 +20,8 @@ export class CLNodeLookupComponent implements OnInit {
constructor(private logger: LoggerService, private snackBar: MatSnackBar) { }
ngOnInit() {
this.addresses = this.lookupResult.addresses ? new MatTableDataSource<any>([...this.lookupResult.addresses]) : new MatTableDataSource([]);
this.addresses.data = this.lookupResult.addresses ? this.lookupResult.addresses : [];
this.addresses = this.lookupResult && this.lookupResult.addresses ? new MatTableDataSource<any>([...this.lookupResult.addresses]) : new MatTableDataSource([]);
this.addresses.data = this.lookupResult && this.lookupResult.addresses ? this.lookupResult.addresses : [];
this.addresses.sort = this.sort;
this.addresses.sortingDataAccessor = (data: any, sortHeaderId: string) => (data[sortHeaderId] && isNaN(data[sortHeaderId])) ? data[sortHeaderId].toLocaleLowerCase() : data[sortHeaderId] ? +data[sortHeaderId] : null;
}

View File

@ -1,4 +1,4 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { CLFeeRatesComponent } from './fee-rates.component';
@ -6,7 +6,7 @@ describe('CLFeeRatesComponent', () => {
let component: CLFeeRatesComponent;
let fixture: ComponentFixture<CLFeeRatesComponent>;
beforeEach(async(() => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ CLFeeRatesComponent ]
})
@ -22,4 +22,9 @@ describe('CLFeeRatesComponent', () => {
it('should create', () => {
expect(component).toBeTruthy();
});
afterEach(() => {
TestBed.resetTestingModule();
});
});

View File

@ -1,14 +1,34 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { StoreModule } from '@ngrx/store';
import { CommonService } from '../../shared/services/common.service';
import { LoggerService } from '../../shared/services/logger.service';
import { mockCommonService } from '../../shared/services/test-consts';
import { SharedModule } from '../../shared/shared.module';
import { RTLReducer } from '../../store/rtl.reducers';
import { CLFeeRatesComponent } from './fee-rates/fee-rates.component';
import { CLNetworkInfoComponent } from './network-info.component';
describe('CLNetworkInfoComponent', () => {
let component: CLNetworkInfoComponent;
let fixture: ComponentFixture<CLNetworkInfoComponent>;
beforeEach(async(() => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ CLNetworkInfoComponent ]
declarations: [ CLNetworkInfoComponent, CLFeeRatesComponent ],
imports: [
SharedModule,
StoreModule.forRoot(RTLReducer, {
runtimeChecks: {
strictStateImmutability: false,
strictActionImmutability: false
}
}),
],
providers: [
LoggerService,
{ provide: CommonService, useClass: mockCommonService }
]
})
.compileComponents();
}));
@ -22,4 +42,9 @@ describe('CLNetworkInfoComponent', () => {
it('should create', () => {
expect(component).toBeTruthy();
});
afterEach(() => {
TestBed.resetTestingModule();
});
});

View File

@ -1,14 +1,35 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { EffectsModule } from '@ngrx/effects';
import { StoreModule } from '@ngrx/store';
import { mockCLEffects, mockECLEffects, mockLNDEffects, mockRTLEffects } from '../../../shared/services/test-consts';
import { SharedModule } from '../../../shared/shared.module';
import { RTLReducer } from '../../../store/rtl.reducers';
import { CLEffects } from '../../store/cl.effects';
import { CLOnChainReceiveComponent } from './on-chain-receive.component';
describe('CLOnChainReceiveComponent', () => {
let component: CLOnChainReceiveComponent;
let fixture: ComponentFixture<CLOnChainReceiveComponent>;
beforeEach(async(() => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ CLOnChainReceiveComponent ]
declarations: [ CLOnChainReceiveComponent ],
imports: [
BrowserAnimationsModule,
SharedModule,
StoreModule.forRoot(RTLReducer, {
runtimeChecks: {
strictStateImmutability: false,
strictActionImmutability: false
}
}),
EffectsModule.forRoot([mockRTLEffects, mockLNDEffects, mockCLEffects, mockECLEffects])
],
providers: [
{ provide: CLEffects, useClass: mockCLEffects }
]
})
.compileComponents();
}));
@ -22,4 +43,9 @@ describe('CLOnChainReceiveComponent', () => {
it('should create', () => {
expect(component).toBeTruthy();
});
afterEach(() => {
TestBed.resetTestingModule();
});
});

View File

@ -1,14 +1,43 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { SharedModule } from '../../../shared/shared.module';
import { StoreModule } from '@ngrx/store';
import { EffectsModule } from '@ngrx/effects';
import { RTLReducer } from '../../../store/rtl.reducers';
import { CommonService } from '../../../shared/services/common.service';
import { LoggerService } from '../../../shared/services/logger.service';
import { CLOnChainSendModalComponent } from './on-chain-send-modal.component';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
import { mockCLEffects, mockCommonService, mockECLEffects, mockLNDEffects, mockMatDialogRef, mockRTLEffects } from '../../../shared/services/test-consts';
import { RTLEffects } from '../../../store/rtl.effects';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
describe('CLOnChainSendModalComponent', () => {
let component: CLOnChainSendModalComponent;
let fixture: ComponentFixture<CLOnChainSendModalComponent>;
beforeEach(async(() => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ CLOnChainSendModalComponent ]
declarations: [ CLOnChainSendModalComponent ],
imports: [
BrowserAnimationsModule,
SharedModule,
StoreModule.forRoot(RTLReducer, {
runtimeChecks: {
strictStateImmutability: false,
strictActionImmutability: false
}
}),
EffectsModule.forRoot([mockRTLEffects, mockLNDEffects, mockCLEffects, mockECLEffects])
],
providers: [
LoggerService,
{ provide: MatDialogRef, useClass: mockMatDialogRef },
{ provide: MAT_DIALOG_DATA, useValue: { sweepAll: true } },
{ provide: CommonService, useClass: mockCommonService },
{ provide: RTLEffects, useClass: mockRTLEffects }
]
})
.compileComponents();
}));
@ -22,4 +51,9 @@ describe('CLOnChainSendModalComponent', () => {
it('should create', () => {
expect(component).toBeTruthy();
});
afterEach(() => {
TestBed.resetTestingModule();
});
});

View File

@ -71,7 +71,7 @@ export class CLOnChainSendModalComponent implements OnInit, OnDestroy {
confirmFormGroup: FormGroup;
private unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject(), new Subject(), new Subject(), new Subject()];
constructor(public dialogRef: MatDialogRef<CLOnChainSendModalComponent>, @Inject(MAT_DIALOG_DATA) public data: CLOnChainSendFunds, private logger: LoggerService, private store: Store<fromRTLReducer.RTLState>, private commonService: CommonService, private decimalPipe: DecimalPipe, private actions$: Actions, private formBuilder: FormBuilder, private rtlEffects: RTLEffects, private snackBar: MatSnackBar) {}
constructor(public dialogRef: MatDialogRef<CLOnChainSendModalComponent>, @Inject(MAT_DIALOG_DATA) public data: CLOnChainSendFunds, private logger: LoggerService, private store: Store<fromRTLReducer.RTLState>, private commonService: CommonService, private decimalPipe: DecimalPipe, private actions: Actions, private formBuilder: FormBuilder, private rtlEffects: RTLEffects, private snackBar: MatSnackBar) {}
ngOnInit() {
this.sweepAll = this.data.sweepAll;
@ -119,7 +119,7 @@ export class CLOnChainSendModalComponent implements OnInit, OnDestroy {
this.logger.info(rootStore);
this.logger.info(rtlStore);
});
this.actions$.pipe(takeUntil(this.unSubs[1]),
this.actions.pipe(takeUntil(this.unSubs[1]),
filter(action => action.type === CLActions.EFFECT_ERROR_CL || action.type === CLActions.SET_CHANNEL_TRANSACTION_RES_CL))
.subscribe((action: CLActions.EffectError | CLActions.SetChannelTransactionRes) => {
if (action.type === CLActions.SET_CHANNEL_TRANSACTION_RES_CL) {

View File

@ -1,14 +1,28 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { StoreModule } from '@ngrx/store';
import { SharedModule } from '../../../shared/shared.module';
import { RTLReducer } from '../../../store/rtl.reducers';
import { CLOnChainSendComponent } from './on-chain-send.component';
describe('CLOnChainSendComponent', () => {
let component: CLOnChainSendComponent;
let fixture: ComponentFixture<CLOnChainSendComponent>;
beforeEach(async(() => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ CLOnChainSendComponent ]
declarations: [ CLOnChainSendComponent ],
imports: [
SharedModule,
RouterTestingModule,
StoreModule.forRoot(RTLReducer, {
runtimeChecks: {
strictStateImmutability: false,
strictActionImmutability: false
}
}),
]
})
.compileComponents();
}));
@ -22,4 +36,9 @@ describe('CLOnChainSendComponent', () => {
it('should create', () => {
expect(component).toBeTruthy();
});
afterEach(() => {
TestBed.resetTestingModule();
});
});

View File

@ -17,13 +17,13 @@
<mat-card>
<mat-card-content fxLayout="column">
<nav mat-tab-nav-bar>
<div role="tab" mat-tab-link *ngFor="let link of links" class="mat-tab-label" [active]="activeLink === link.link" (click)="activeLink = link.link" [routerLink]="[link.link, selectedTable.name]">{{link.name}}</div>
<div role="tab" mat-tab-link *ngFor="let link of links" class="mat-tab-label" [active]="activeLink === link?.link" (click)="activeLink = link?.link" [routerLink]="[link?.link, selectedTable?.name]">{{link?.name}}</div>
</nav>
<div fxLayout="column" fxFlex="100" fxLayoutAlign="space-between stretch" class="mat-tab-body-wrapper">
<router-outlet></router-outlet>
</div>
<div fxLayout="column" fxFlex="100" fxLayoutAlign="space-between stretch" class="padding-gap-x-large">
<rtl-cl-utxo-tables [selectedTableIndex]="selectedTable.id" (selectedTableIndexChange)="onSelectedTableIndexChanged($event)" fxLayout="row" fxFlex="100"></rtl-cl-utxo-tables>
<rtl-cl-utxo-tables [selectedTableIndex]="selectedTable?.id" (selectedTableIndexChange)="onSelectedTableIndexChanged($event)" fxLayout="row" fxFlex="100"></rtl-cl-utxo-tables>
</div>
</mat-card-content>
</mat-card>

View File

@ -1,14 +1,40 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { RouterTestingModule } from "@angular/router/testing";
import { StoreModule } from '@ngrx/store';
import { SharedModule } from '../../shared/shared.module';
import { RTLReducer } from '../../store/rtl.reducers';
import { CLOnChainComponent } from './on-chain.component';
import { CLOnChainUtxosComponent } from './utxo-tables/utxos/utxos.component';
import { CLOnChainSendComponent } from './on-chain-send/on-chain-send.component';
import { CLOnChainReceiveComponent } from './on-chain-receive/on-chain-receive.component';
import { CurrencyUnitConverterComponent } from '../../shared/components/currency-unit-converter/currency-unit-converter.component';
import { CommonService } from '../../shared/services/common.service';
import { mockCommonService } from '../../shared/services/test-consts';
import { CLUTXOTablesComponent } from './utxo-tables/utxo-tables.component';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
describe('CLOnChainComponent', () => {
let component: CLOnChainComponent;
let fixture: ComponentFixture<CLOnChainComponent>;
beforeEach(async(() => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ CLOnChainComponent ]
declarations: [ CLOnChainComponent, CurrencyUnitConverterComponent, CLUTXOTablesComponent, CLOnChainUtxosComponent, CLOnChainSendComponent, CLOnChainReceiveComponent ],
imports: [
BrowserAnimationsModule,
SharedModule,
RouterTestingModule,
StoreModule.forRoot(RTLReducer, {
runtimeChecks: {
strictStateImmutability: false,
strictActionImmutability: false
}
})
],
providers: [
{ provide: CommonService, useClass: mockCommonService }
]
})
.compileComponents();
}));
@ -22,4 +48,9 @@ describe('CLOnChainComponent', () => {
it('should create', () => {
expect(component).toBeTruthy();
});
afterEach(() => {
TestBed.resetTestingModule();
});
});

View File

@ -1,14 +1,36 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { StoreModule } from '@ngrx/store';
import { CommonService } from '../../../shared/services/common.service';
import { LoggerService } from '../../../shared/services/logger.service';
import { mockCommonService } from '../../../shared/services/test-consts';
import { SharedModule } from '../../../shared/shared.module';
import { RTLReducer } from '../../../store/rtl.reducers';
import { CLUTXOTablesComponent } from './utxo-tables.component';
import { CLOnChainUtxosComponent } from './utxos/utxos.component';
describe('CLUTXOTablesComponent', () => {
let component: CLUTXOTablesComponent;
let fixture: ComponentFixture<CLUTXOTablesComponent>;
beforeEach(async(() => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ CLUTXOTablesComponent ]
declarations: [ CLUTXOTablesComponent, CLOnChainUtxosComponent ],
imports: [
BrowserAnimationsModule,
SharedModule,
StoreModule.forRoot(RTLReducer, {
runtimeChecks: {
strictStateImmutability: false,
strictActionImmutability: false
}
})
],
providers: [
LoggerService,
{ provide: CommonService, useClass: mockCommonService }
]
})
.compileComponents();
}));
@ -22,4 +44,9 @@ describe('CLUTXOTablesComponent', () => {
it('should create', () => {
expect(component).toBeTruthy();
});
afterEach(() => {
TestBed.resetTestingModule();
});
});

View File

@ -1,14 +1,35 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { StoreModule } from '@ngrx/store';
import { CommonService } from '../../../../shared/services/common.service';
import { LoggerService } from '../../../../shared/services/logger.service';
import { mockCommonService } from '../../../../shared/services/test-consts';
import { SharedModule } from '../../../../shared/shared.module';
import { RTLReducer } from '../../../../store/rtl.reducers';
import { CLOnChainUtxosComponent } from './utxos.component';
describe('CLOnChainUtxosComponent', () => {
let component: CLOnChainUtxosComponent;
let fixture: ComponentFixture<CLOnChainUtxosComponent>;
beforeEach(async(() => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ CLOnChainUtxosComponent ]
declarations: [ CLOnChainUtxosComponent ],
imports: [
BrowserAnimationsModule,
SharedModule,
StoreModule.forRoot(RTLReducer, {
runtimeChecks: {
strictStateImmutability: false,
strictActionImmutability: false
}
})
],
providers: [
LoggerService,
{ provide: CommonService, useClass: mockCommonService }
]
})
.compileComponents();
}));
@ -22,4 +43,9 @@ describe('CLOnChainUtxosComponent', () => {
it('should create', () => {
expect(component).toBeTruthy();
});
afterEach(() => {
TestBed.resetTestingModule();
});
});

View File

@ -1,6 +1,5 @@
import { Component, ViewChild, Input, OnChanges, AfterViewInit } from '@angular/core';
import { Store } from '@ngrx/store';
import { Actions } from '@ngrx/effects';
import { MatPaginator, MatPaginatorIntl } from '@angular/material/paginator';
import { MatSort } from '@angular/material/sort';
@ -36,7 +35,7 @@ export class CLOnChainUtxosComponent implements OnChanges, AfterViewInit {
public screenSize = '';
public screenSizeEnum = ScreenSizeEnum;
constructor(private logger: LoggerService, private commonService: CommonService, private store: Store<fromRTLReducer.RTLState>, private actions$: Actions) {
constructor(private logger: LoggerService, private commonService: CommonService, private store: Store<fromRTLReducer.RTLState>) {
this.screenSize = this.commonService.getScreenSize();
if(this.screenSize === ScreenSizeEnum.XS) {
this.flgSticky = false;

View File

@ -1,4 +1,9 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
import { CommonService } from '../../../../shared/services/common.service';
import { LoggerService } from '../../../../shared/services/logger.service';
import { mockCommonService, mockMatDialogRef } from '../../../../shared/services/test-consts';
import { SharedModule } from '../../../../shared/shared.module';
import { CLChannelInformationComponent } from './channel-information.component';
@ -6,9 +11,18 @@ describe('CLChannelInformationComponent', () => {
let component: CLChannelInformationComponent;
let fixture: ComponentFixture<CLChannelInformationComponent>;
beforeEach(async(() => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ CLChannelInformationComponent ]
declarations: [ CLChannelInformationComponent ],
imports: [
SharedModule
],
providers: [
LoggerService,
{ provide: MatDialogRef, useClass: mockMatDialogRef },
{ provide: MAT_DIALOG_DATA, useValue: {channel:{}} },
{ provide: CommonService, useClass: mockCommonService }
]
})
.compileComponents();
}));
@ -22,4 +36,9 @@ describe('CLChannelInformationComponent', () => {
it('should create', () => {
expect(component).toBeTruthy();
});
afterEach(() => {
TestBed.resetTestingModule();
});
});

View File

@ -1,14 +1,41 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { EffectsModule } from '@ngrx/effects';
import { StoreModule } from '@ngrx/store';
import { CommonService } from '../../../../../shared/services/common.service';
import { LoggerService } from '../../../../../shared/services/logger.service';
import { mockCLEffects, mockCommonService, mockECLEffects, mockLNDEffects, mockRTLEffects } from '../../../../../shared/services/test-consts';
import { SharedModule } from '../../../../../shared/shared.module';
import { RTLEffects } from '../../../../../store/rtl.effects';
import { RTLReducer } from '../../../../../store/rtl.reducers';
import { CLEffects } from '../../../../store/cl.effects';
import { CLChannelOpenTableComponent } from './channel-open-table.component';
describe('CLChannelOpenTableComponent', () => {
let component: CLChannelOpenTableComponent;
let fixture: ComponentFixture<CLChannelOpenTableComponent>;
beforeEach(async(() => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ CLChannelOpenTableComponent ]
declarations: [ CLChannelOpenTableComponent ],
imports: [
BrowserAnimationsModule,
SharedModule,
StoreModule.forRoot(RTLReducer, {
runtimeChecks: {
strictStateImmutability: false,
strictActionImmutability: false
}
}),
EffectsModule.forRoot([mockRTLEffects, mockLNDEffects, mockCLEffects, mockECLEffects])
],
providers: [
LoggerService,
{ provide: CommonService, useClass: mockCommonService },
{ provide: RTLEffects, useClass: mockRTLEffects },
{ provide: CLEffects, useClass: mockCLEffects }
]
})
.compileComponents();
}));
@ -22,4 +49,9 @@ describe('CLChannelOpenTableComponent', () => {
it('should create', () => {
expect(component).toBeTruthy();
});
afterEach(() => {
TestBed.resetTestingModule();
});
});

View File

@ -1,14 +1,40 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { StoreModule } from '@ngrx/store';
import { RTLReducer } from '../../../../../store/rtl.reducers';
import { CommonService } from '../../../../../shared/services/common.service';
import { LoggerService } from '../../../../../shared/services/logger.service';
import { CLChannelPendingTableComponent } from './channel-pending-table.component';
import { mockCLEffects, mockCommonService, mockECLEffects, mockLNDEffects, mockRTLEffects } from '../../../../../shared/services/test-consts';
import { EffectsModule } from '@ngrx/effects';
import { RTLEffects } from '../../../../../store/rtl.effects';
import { SharedModule } from '../../../../../shared/shared.module';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
describe('CLChannelPendingTableComponent', () => {
let component: CLChannelPendingTableComponent;
let fixture: ComponentFixture<CLChannelPendingTableComponent>;
beforeEach(async(() => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ CLChannelPendingTableComponent ]
declarations: [ CLChannelPendingTableComponent ],
imports: [
BrowserAnimationsModule,
SharedModule,
StoreModule.forRoot(RTLReducer, {
runtimeChecks: {
strictStateImmutability: false,
strictActionImmutability: false
}
}),
EffectsModule.forRoot([mockRTLEffects, mockLNDEffects, mockCLEffects, mockECLEffects])
],
providers: [
LoggerService,
{ provide: CommonService, useClass: mockCommonService },
{ provide: RTLEffects, useClass: mockRTLEffects }
]
})
.compileComponents();
}));
@ -22,4 +48,9 @@ describe('CLChannelPendingTableComponent', () => {
it('should create', () => {
expect(component).toBeTruthy();
});
afterEach(() => {
TestBed.resetTestingModule();
});
});

View File

@ -47,7 +47,7 @@ export class CLChannelPendingTableComponent implements OnInit, AfterViewInit, On
public screenSizeEnum = ScreenSizeEnum;
private unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject(), new Subject(), new Subject(), new Subject()];
constructor(private logger: LoggerService, private store: Store<fromRTLReducer.RTLState>, private rtlEffects: RTLEffects, private clEffects: CLEffects, private commonService: CommonService) {
constructor(private logger: LoggerService, private store: Store<fromRTLReducer.RTLState>, private rtlEffects: RTLEffects, private commonService: CommonService) {
this.screenSize = this.commonService.getScreenSize();
if(this.screenSize === ScreenSizeEnum.XS) {
this.flgSticky = false;
@ -80,7 +80,7 @@ export class CLChannelPendingTableComponent implements OnInit, AfterViewInit, On
this.numPeers = (rtlStore.peers && rtlStore.peers.length) ? rtlStore.peers.length : 0;
this.totalBalance = rtlStore.balance.totalBalance;
this.channelsData = this.commonService.sortByKey(rtlStore.allChannels.filter(channel => !(channel.state === 'CHANNELD_NORMAL' && channel.connected)), 'state', 'string');
if (this.channelsData.length > 0) {
if (this.channelsData && this.channelsData.length > 0) {
this.loadChannelsTable(this.channelsData);
}
if (this.flgLoading[0] !== 'error') {
@ -91,7 +91,7 @@ export class CLChannelPendingTableComponent implements OnInit, AfterViewInit, On
}
ngAfterViewInit() {
if (this.channelsData.length > 0) {
if (this.channelsData && this.channelsData.length > 0) {
this.loadChannelsTable(this.channelsData);
}
}

View File

@ -1,14 +1,37 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { RouterTestingModule } from '@angular/router/testing';
import { StoreModule } from '@ngrx/store';
import { CommonService } from '../../../../shared/services/common.service';
import { LoggerService } from '../../../../shared/services/logger.service';
import { mockCommonService } from '../../../../shared/services/test-consts';
import { SharedModule } from '../../../../shared/shared.module';
import { RTLReducer } from '../../../../store/rtl.reducers';
import { CLChannelsTablesComponent } from './channels-tables.component';
describe('CLChannelsTablesComponent', () => {
let component: CLChannelsTablesComponent;
let fixture: ComponentFixture<CLChannelsTablesComponent>;
beforeEach(async(() => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ CLChannelsTablesComponent ]
declarations: [ CLChannelsTablesComponent ],
imports: [
BrowserAnimationsModule,
SharedModule,
RouterTestingModule,
StoreModule.forRoot(RTLReducer, {
runtimeChecks: {
strictStateImmutability: false,
strictActionImmutability: false
}
})
],
providers: [
LoggerService,
{ provide: CommonService, useClass: mockCommonService }
]
})
.compileComponents();
}));
@ -22,4 +45,9 @@ describe('CLChannelsTablesComponent', () => {
it('should create', () => {
expect(component).toBeTruthy();
});
afterEach(() => {
TestBed.resetTestingModule();
});
});

View File

@ -1,14 +1,36 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
import { StoreModule } from '@ngrx/store';
import { RTLReducer } from '../../../../store/rtl.reducers';
import { CLOpenChannelComponent } from './open-channel.component';
import { mockCLEffects, mockECLEffects, mockLNDEffects, mockMatDialogRef, mockRTLEffects } from '../../../../shared/services/test-consts';
import { EffectsModule } from '@ngrx/effects';
import { SharedModule } from '../../../../shared/shared.module';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
describe('CLOpenChannelComponent', () => {
let component: CLOpenChannelComponent;
let fixture: ComponentFixture<CLOpenChannelComponent>;
beforeEach(async(() => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ CLOpenChannelComponent ]
declarations: [ CLOpenChannelComponent ],
imports: [
BrowserAnimationsModule,
SharedModule,
StoreModule.forRoot(RTLReducer, {
runtimeChecks: {
strictStateImmutability: false,
strictActionImmutability: false
}
}),
EffectsModule.forRoot([mockRTLEffects, mockLNDEffects, mockCLEffects, mockECLEffects])
],
providers: [
{ provide: MatDialogRef, useClass: mockMatDialogRef },
{ provide: MAT_DIALOG_DATA, useValue: {message:{}} }
]
})
.compileComponents();
}));
@ -22,4 +44,8 @@ describe('CLOpenChannelComponent', () => {
it('should create', () => {
expect(component).toBeTruthy();
});
afterEach(() => {
TestBed.resetTestingModule();
});
});

View File

@ -48,7 +48,7 @@ export class CLOpenChannelComponent implements OnInit, OnDestroy {
public minConfValue = null;
private unSubs: Array<Subject<void>> = [new Subject(), new Subject()];
constructor(public dialogRef: MatDialogRef<CLOpenChannelComponent>, @Inject(MAT_DIALOG_DATA) public data: CLOpenChannelAlert, private store: Store<fromRTLReducer.RTLState>, private actions$: Actions, private decimalPipe: DecimalPipe) {}
constructor(public dialogRef: MatDialogRef<CLOpenChannelComponent>, @Inject(MAT_DIALOG_DATA) public data: CLOpenChannelAlert, private store: Store<fromRTLReducer.RTLState>, private actions: Actions, private decimalPipe: DecimalPipe) {}
ngOnInit() {
this.isCompatibleVersion = this.data.message.isCompatibleVersion;
@ -58,7 +58,7 @@ export class CLOpenChannelComponent implements OnInit, OnDestroy {
this.alertTitle = this.data.alertTitle;
this.peer = this.data.message.peer ? this.data.message.peer : null;
this.peers = this.data.message.peers && this.data.message.peers.length ? this.data.message.peers : [];
this.actions$.pipe(takeUntil(this.unSubs[0]),
this.actions.pipe(takeUntil(this.unSubs[0]),
filter(action => action.type === CLActions.EFFECT_ERROR_CL || action.type === CLActions.FETCH_CHANNELS_CL))
.subscribe((action: CLActions.EffectError | CLActions.FetchChannels) => {
if (action.type === CLActions.EFFECT_ERROR_CL && action.payload.action === 'SaveNewChannel') {

View File

@ -1,14 +1,39 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
import { StoreModule } from '@ngrx/store';
import { RTLReducer } from '../../../store/rtl.reducers';
import { SharedModule } from '../../../shared/shared.module';
import { LoggerService } from '../../../shared/services/logger.service';
import { CLConnectPeerComponent } from './connect-peer.component';
import { mockCLEffects, mockECLEffects, mockLNDEffects, mockMatDialogRef, mockRTLEffects } from '../../../shared/services/test-consts';
import { EffectsModule } from '@ngrx/effects';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
describe('CLConnectPeerComponent', () => {
let component: CLConnectPeerComponent;
let fixture: ComponentFixture<CLConnectPeerComponent>;
beforeEach(async(() => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ CLConnectPeerComponent ]
declarations: [ CLConnectPeerComponent ],
imports: [
BrowserAnimationsModule,
SharedModule,
StoreModule.forRoot(RTLReducer, {
runtimeChecks: {
strictStateImmutability: false,
strictActionImmutability: false
}
}),
EffectsModule.forRoot([mockRTLEffects, mockLNDEffects, mockCLEffects, mockECLEffects])
],
providers: [
LoggerService,
{ provide: MatDialogRef, useClass: mockMatDialogRef },
{ provide: MAT_DIALOG_DATA, useValue: {alertTitle: '', titleMessage: '', message: {}, newlyAdded: true}}
]
})
.compileComponents();
}));
@ -22,4 +47,9 @@ describe('CLConnectPeerComponent', () => {
it('should create', () => {
expect(component).toBeTruthy();
});
afterEach(() => {
TestBed.resetTestingModule();
});
});

View File

@ -43,7 +43,7 @@ export class CLConnectPeerComponent implements OnInit, OnDestroy {
statusFormGroup: FormGroup;
private unSubs: Array<Subject<void>> = [new Subject(), new Subject()];
constructor(public dialogRef: MatDialogRef<CLConnectPeerComponent>, @Inject(MAT_DIALOG_DATA) public data: CLOpenChannelAlert, private store: Store<fromRTLReducer.RTLState>, private clEffects: CLEffects, private formBuilder: FormBuilder, private actions$: Actions, private logger: LoggerService) {}
constructor(public dialogRef: MatDialogRef<CLConnectPeerComponent>, @Inject(MAT_DIALOG_DATA) public data: CLOpenChannelAlert, private store: Store<fromRTLReducer.RTLState>, private formBuilder: FormBuilder, private actions: Actions, private logger: LoggerService) {}
ngOnInit() {
this.totalBalance = this.data.message.balance;
@ -74,7 +74,7 @@ export class CLConnectPeerComponent implements OnInit, OnDestroy {
this.channelFormGroup.controls.minConfValue.setValidators(null);
}
});
this.actions$.pipe(takeUntil(this.unSubs[1]),
this.actions.pipe(takeUntil(this.unSubs[1]),
filter((action) => action.type === CLActions.NEWLY_ADDED_PEER_CL || action.type === CLActions.FETCH_CHANNELS_CL || action.type === CLActions.EFFECT_ERROR_CL))
.subscribe((action: (CLActions.NewlyAddedPeer | CLActions.FetchChannels | CLActions.EffectError)) => {
if (action.type === CLActions.NEWLY_ADDED_PEER_CL) {

View File

@ -1,14 +1,38 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { RouterTestingModule } from '@angular/router/testing';
import { StoreModule } from '@ngrx/store';
import { CurrencyUnitConverterComponent } from '../../shared/components/currency-unit-converter/currency-unit-converter.component';
import { CommonService } from '../../shared/services/common.service';
import { LoggerService } from '../../shared/services/logger.service';
import { mockCommonService } from '../../shared/services/test-consts';
import { SharedModule } from '../../shared/shared.module';
import { RTLReducer } from '../../store/rtl.reducers';
import { CLConnectionsComponent } from './connections.component';
describe('CLConnectionsComponent', () => {
let component: CLConnectionsComponent;
let fixture: ComponentFixture<CLConnectionsComponent>;
beforeEach(async(() => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ CLConnectionsComponent ]
declarations: [ CLConnectionsComponent, CurrencyUnitConverterComponent ],
imports: [
BrowserAnimationsModule,
SharedModule,
RouterTestingModule,
StoreModule.forRoot(RTLReducer, {
runtimeChecks: {
strictStateImmutability: false,
strictActionImmutability: false
}
})
],
providers: [
LoggerService,
{ provide: CommonService, useClass: mockCommonService }
]
})
.compileComponents();
}));
@ -22,4 +46,9 @@ describe('CLConnectionsComponent', () => {
it('should create', () => {
expect(component).toBeTruthy();
});
afterEach(() => {
TestBed.resetTestingModule();
});
});

View File

@ -6,7 +6,6 @@ import { Store } from '@ngrx/store';
import { faUsers, faChartPie } from '@fortawesome/free-solid-svg-icons';
import { LoggerService } from '../../shared/services/logger.service';
import { CommonService } from '../../shared/services/common.service';
import * as fromRTLReducer from '../../store/rtl.reducers';
@ -25,7 +24,7 @@ export class CLConnectionsComponent implements OnInit, OnDestroy {
public activeLink = 0;
private unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject(), new Subject()];
constructor(private store: Store<fromRTLReducer.RTLState>, private logger: LoggerService, private commonService: CommonService, private router: Router) {}
constructor(private store: Store<fromRTLReducer.RTLState>, private logger: LoggerService, private router: Router) {}
ngOnInit() {
this.activeLink = this.links.findIndex(link => link.link === this.router.url.substring(this.router.url.lastIndexOf('/') + 1));

View File

@ -1,14 +1,40 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { StoreModule } from '@ngrx/store';
import { RTLReducer } from '../../../store/rtl.reducers';
import { CommonService } from '../../../shared/services/common.service';
import { LoggerService } from '../../../shared/services/logger.service';
import { CLPeersComponent } from './peers.component';
import { mockCLEffects, mockCommonService, mockECLEffects, mockLNDEffects, mockRTLEffects } from '../../../shared/services/test-consts';
import { EffectsModule } from '@ngrx/effects';
import { RTLEffects } from '../../../store/rtl.effects';
import { SharedModule } from '../../../shared/shared.module';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
describe('CLPeersComponent', () => {
let component: CLPeersComponent;
let fixture: ComponentFixture<CLPeersComponent>;
beforeEach(async(() => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ CLPeersComponent ]
declarations: [ CLPeersComponent ],
imports: [
BrowserAnimationsModule,
SharedModule,
StoreModule.forRoot(RTLReducer, {
runtimeChecks: {
strictStateImmutability: false,
strictActionImmutability: false
}
}),
EffectsModule.forRoot([mockRTLEffects, mockLNDEffects, mockCLEffects, mockECLEffects])
],
providers: [
LoggerService,
{ provide: CommonService, useClass: mockCommonService },
{ provide: RTLEffects, useClass: mockRTLEffects }
]
})
.compileComponents();
}));
@ -22,4 +48,9 @@ describe('CLPeersComponent', () => {
it('should create', () => {
expect(component).toBeTruthy();
});
afterEach(() => {
TestBed.resetTestingModule();
});
});

View File

@ -16,7 +16,6 @@ import { CommonService } from '../../../shared/services/common.service';
import { CLOpenChannelComponent } from '../channels/open-channel-modal/open-channel.component';
import { newlyAddedRowAnimation } from '../../../shared/animation/row-animation';
import { CLEffects } from '../../store/cl.effects';
import { RTLEffects } from '../../../store/rtl.effects';
import * as CLActions from '../../store/cl.actions';
import * as RTLActions from '../../../store/rtl.actions';
@ -52,7 +51,7 @@ export class CLPeersComponent implements OnInit, AfterViewInit, OnDestroy {
public screenSizeEnum = ScreenSizeEnum;
private unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject(), new Subject()];
constructor(private logger: LoggerService, private store: Store<fromRTLReducer.RTLState>, private rtlEffects: RTLEffects, private clEffects: CLEffects, private actions$: Actions, private commonService: CommonService) {
constructor(private logger: LoggerService, private store: Store<fromRTLReducer.RTLState>, private rtlEffects: RTLEffects, private actions: Actions, private commonService: CommonService) {
this.screenSize = this.commonService.getScreenSize();
if(this.screenSize === ScreenSizeEnum.XS) {
this.flgSticky = false;
@ -89,7 +88,7 @@ export class CLPeersComponent implements OnInit, AfterViewInit, OnDestroy {
}
this.logger.info(rtlStore);
});
this.actions$
this.actions
.pipe(
takeUntil(this.unSubs[1]),
filter((action) => action.type === CLActions.SET_PEERS_CL)

View File

@ -1,19 +1,35 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { DataService } from '../../../shared/services/data.service';
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { StoreModule } from '@ngrx/store';
import { RTLReducer } from '../../../store/rtl.reducers';
import { CommonService } from '../../../shared/services/common.service';
import { LoggerService } from '../../../shared/services/logger.service';
import { CLFeeReportComponent } from './fee-report.component';
import { mockCommonService } from '../../../shared/services/test-consts';
import { SharedModule } from '../../../shared/shared.module';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
describe('CLFeeReportComponent', () => {
let component: CLFeeReportComponent;
let fixture: ComponentFixture<CLFeeReportComponent>;
const mockDataService = jasmine.createSpyObj("DataService", ["getChildAPIUrl","setChildAPIUrl","getFiatRates",
"getAliasesFromPubkeys","signMessage","verifyMessage","handleErrorWithoutAlert","handleErrorWithAlert"]);
beforeEach(async(() => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ CLFeeReportComponent ],
imports: [
BrowserAnimationsModule,
SharedModule,
StoreModule.forRoot(RTLReducer, {
runtimeChecks: {
strictStateImmutability: false,
strictActionImmutability: false
}
})
],
providers: [
{ provide: DataService, useValue: mockDataService }
LoggerService,
{ provide: CommonService, useClass: mockCommonService }
]
})
.compileComponents();
@ -28,4 +44,9 @@ describe('CLFeeReportComponent', () => {
it('should create', () => {
expect(component).toBeTruthy();
});
afterEach(() => {
TestBed.resetTestingModule();
});
});

View File

@ -1,4 +1,4 @@
import { Component, OnInit, OnDestroy, HostListener, AfterViewInit } from '@angular/core';
import { Component, OnInit, OnDestroy, HostListener, AfterContentInit } from '@angular/core';
import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
import { Store } from '@ngrx/store';
@ -7,7 +7,6 @@ import { ForwardingHistoryRes, ForwardingEvent } from '../../../shared/models/cl
import { MONTHS, ScreenSizeEnum, SCROLL_RANGES } from '../../../shared/services/consts-enums-functions';
import { LoggerService } from '../../../shared/services/logger.service';
import { CommonService } from '../../../shared/services/common.service';
import { DataService } from '../../../shared/services/data.service';
import { fadeIn } from '../../../shared/animation/opacity-animation';
import * as fromRTLReducer from '../../../store/rtl.reducers';
@ -18,7 +17,7 @@ import * as fromRTLReducer from '../../../store/rtl.reducers';
styleUrls: ['./fee-report.component.scss'],
animations: [fadeIn]
})
export class CLFeeReportComponent implements OnInit, AfterViewInit, OnDestroy {
export class CLFeeReportComponent implements OnInit, AfterContentInit, OnDestroy {
public reportPeriod = SCROLL_RANGES[0];
public secondsInADay = 24 * 60 * 60;
public events: ForwardingHistoryRes = {};
@ -40,7 +39,7 @@ export class CLFeeReportComponent implements OnInit, AfterViewInit, OnDestroy {
public screenSizeEnum = ScreenSizeEnum;
private unSubs: Array<Subject<void>> = [new Subject(), new Subject()];
constructor(private logger: LoggerService, private dataService: DataService, private commonService: CommonService, private store: Store<fromRTLReducer.RTLState>) {}
constructor(private logger: LoggerService, private commonService: CommonService, private store: Store<fromRTLReducer.RTLState>) {}
ngOnInit() {
this.screenSize = this.commonService.getScreenSize();
@ -60,7 +59,7 @@ export class CLFeeReportComponent implements OnInit, AfterViewInit, OnDestroy {
});
}
ngAfterViewInit() {
ngAfterContentInit() {
const CONTAINER_SIZE = this.commonService.getContainerSize();
switch (this.screenSize) {
case ScreenSizeEnum.MD:

View File

@ -1,4 +1,6 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { SharedModule } from '../../shared/shared.module';
import { CLReportsComponent } from './reports.component';
@ -6,9 +8,10 @@ describe('CLReportsComponent', () => {
let component: CLReportsComponent;
let fixture: ComponentFixture<CLReportsComponent>;
beforeEach(async(() => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ CLReportsComponent ]
declarations: [ CLReportsComponent ],
imports: [ SharedModule, RouterTestingModule ]
})
.compileComponents();
}));
@ -22,4 +25,9 @@ describe('CLReportsComponent', () => {
it('should create', () => {
expect(component).toBeTruthy();
});
afterEach(() => {
TestBed.resetTestingModule();
});
});

View File

@ -1,16 +1,37 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { StoreModule } from '@ngrx/store';
import { RTLReducer } from '../../../store/rtl.reducers';
import { CommonService } from '../../../shared/services/common.service';
import { CLTransactionsReportComponent } from './transactions-report.component';
import { mockCommonService } from '../../../shared/services/test-consts';
import { SharedModule } from '../../../shared/shared.module';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
describe('CLTransactionsReportComponent', () => {
let component: CLTransactionsReportComponent;
let fixture: ComponentFixture<CLTransactionsReportComponent>;
beforeEach(async(() => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ CLTransactionsReportComponent ]
declarations: [ CLTransactionsReportComponent ],
imports: [
BrowserAnimationsModule,
SharedModule,
StoreModule.forRoot(RTLReducer, {
runtimeChecks: {
strictStateImmutability: false,
strictActionImmutability: false
}
})
],
providers: [
{ provide: CommonService, useClass: mockCommonService }
]
})
.compileComponents();
let service = TestBed.inject(CommonService);
}));
beforeEach(() => {
@ -22,4 +43,9 @@ describe('CLTransactionsReportComponent', () => {
it('should create', () => {
expect(component).toBeTruthy();
});
afterEach(() => {
TestBed.resetTestingModule();
});
});

View File

@ -1,4 +1,4 @@
import { Component, OnInit, OnDestroy, HostListener, AfterViewInit } from '@angular/core';
import { Component, OnInit, OnDestroy, HostListener, AfterContentInit } from '@angular/core';
import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
import { Store } from '@ngrx/store';
@ -16,7 +16,7 @@ import * as fromRTLReducer from '../../../store/rtl.reducers';
styleUrls: ['./transactions-report.component.scss'],
animations: [fadeIn]
})
export class CLTransactionsReportComponent implements OnInit, AfterViewInit, OnDestroy {
export class CLTransactionsReportComponent implements OnInit, AfterContentInit, OnDestroy {
public scrollRanges = SCROLL_RANGES;
public reportPeriod = SCROLL_RANGES[0];
public secondsInADay = 24 * 60 * 60;
@ -54,7 +54,7 @@ export class CLTransactionsReportComponent implements OnInit, AfterViewInit, OnD
});
}
ngAfterViewInit() {
ngAfterContentInit() {
const CONTAINER_SIZE = this.commonService.getContainerSize();
switch (this.screenSize) {
case ScreenSizeEnum.MD:

View File

@ -1,14 +1,36 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { StoreModule } from '@ngrx/store';
import { RTLReducer } from '../../../store/rtl.reducers';
import { CommonService } from '../../../shared/services/common.service';
import { LoggerService } from '../../../shared/services/logger.service';
import { CLFailedTransactionsComponent } from './failed-transactions.component';
import { mockCommonService } from '../../../shared/services/test-consts';
import { SharedModule } from '../../../shared/shared.module';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
describe('CLFailedTransactionsComponent', () => {
let component: CLFailedTransactionsComponent;
let fixture: ComponentFixture<CLFailedTransactionsComponent>;
beforeEach(async(() => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ CLFailedTransactionsComponent ]
declarations: [ CLFailedTransactionsComponent ],
imports: [
BrowserAnimationsModule,
SharedModule,
StoreModule.forRoot(RTLReducer, {
runtimeChecks: {
strictStateImmutability: false,
strictActionImmutability: false
}
})
],
providers: [
LoggerService,
{ provide: CommonService, useClass: mockCommonService }
]
})
.compileComponents();
}));
@ -22,4 +44,9 @@ describe('CLFailedTransactionsComponent', () => {
it('should create', () => {
expect(component).toBeTruthy();
});
afterEach(() => {
TestBed.resetTestingModule();
});
});

View File

@ -1,14 +1,36 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { StoreModule } from '@ngrx/store';
import { RTLReducer } from '../../../store/rtl.reducers';
import { CommonService } from '../../../shared/services/common.service';
import { LoggerService } from '../../../shared/services/logger.service';
import { CLForwardingHistoryComponent } from './forwarding-history.component';
import { mockCommonService } from '../../../shared/services/test-consts';
import { SharedModule } from '../../../shared/shared.module';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
describe('CLForwardingHistoryComponent', () => {
let component: CLForwardingHistoryComponent;
let fixture: ComponentFixture<CLForwardingHistoryComponent>;
beforeEach(async(() => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ CLForwardingHistoryComponent ]
declarations: [ CLForwardingHistoryComponent ],
imports: [
BrowserAnimationsModule,
SharedModule,
StoreModule.forRoot(RTLReducer, {
runtimeChecks: {
strictStateImmutability: false,
strictActionImmutability: false
}
})
],
providers: [
LoggerService,
{ provide: CommonService, useClass: mockCommonService }
]
})
.compileComponents();
}));
@ -22,4 +44,9 @@ describe('CLForwardingHistoryComponent', () => {
it('should create', () => {
expect(component).toBeTruthy();
});
afterEach(() => {
TestBed.resetTestingModule();
});
});

View File

@ -1,4 +1,6 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { SharedModule } from '../../shared/shared.module';
import { CLRoutingComponent } from './routing.component';
@ -6,9 +8,10 @@ describe('CLRoutingComponent', () => {
let component: CLRoutingComponent;
let fixture: ComponentFixture<CLRoutingComponent>;
beforeEach(async(() => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ CLRoutingComponent ]
declarations: [ CLRoutingComponent ],
imports: [ SharedModule, RouterTestingModule ]
})
.compileComponents();
}));
@ -22,4 +25,9 @@ describe('CLRoutingComponent', () => {
it('should create', () => {
expect(component).toBeTruthy();
});
afterEach(() => {
TestBed.resetTestingModule();
});
});

View File

@ -18,7 +18,7 @@ export class CLRoutingComponent implements OnInit, OnDestroy {
public activeLink = this.links[0].link;
private unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject()];
constructor(private store: Store<fromRTLReducer.RTLState>, private router: Router) {}
constructor(private router: Router) {}
ngOnInit() {
let linkFound = this.links.find(link => this.router.url.includes(link.link));

View File

@ -1,4 +1,6 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { SharedModule } from '../../shared/shared.module';
import { CLSignVerifyMessageComponent } from './sign-verify-message.component';
@ -6,9 +8,10 @@ describe('CLSignVerifyMessageComponent', () => {
let component: CLSignVerifyMessageComponent;
let fixture: ComponentFixture<CLSignVerifyMessageComponent>;
beforeEach(async(() => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ CLSignVerifyMessageComponent ]
declarations: [ CLSignVerifyMessageComponent ],
imports: [ SharedModule, RouterTestingModule ]
})
.compileComponents();
}));
@ -22,4 +25,9 @@ describe('CLSignVerifyMessageComponent', () => {
it('should create', () => {
expect(component).toBeTruthy();
});
afterEach(() => {
TestBed.resetTestingModule();
});
});

View File

@ -1,14 +1,28 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { LoggerService } from '../../../shared/services/logger.service';
import { DataService } from '../../../shared/services/data.service';
import { CLSignComponent } from './sign.component';
import { mockDataService } from '../../../shared/services/test-consts';
import { SharedModule } from '../../../shared/shared.module';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
describe('CLSignComponent', () => {
let component: CLSignComponent;
let fixture: ComponentFixture<CLSignComponent>;
beforeEach(async(() => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ CLSignComponent ]
declarations: [ CLSignComponent ],
imports: [
BrowserAnimationsModule,
SharedModule
],
providers: [
LoggerService,
{ provide: DataService, useClass: mockDataService }
]
})
.compileComponents();
}));
@ -22,4 +36,9 @@ describe('CLSignComponent', () => {
it('should create', () => {
expect(component).toBeTruthy();
});
afterEach(() => {
TestBed.resetTestingModule();
});
});

View File

@ -1,14 +1,28 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { LoggerService } from '../../../shared/services/logger.service';
import { DataService } from '../../../shared/services/data.service';
import { CLVerifyComponent } from './verify.component';
import { mockDataService } from '../../../shared/services/test-consts';
import { SharedModule } from '../../../shared/shared.module';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
describe('CLVerifyComponent', () => {
let component: CLVerifyComponent;
let fixture: ComponentFixture<CLVerifyComponent>;
beforeEach(async(() => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ CLVerifyComponent ]
declarations: [ CLVerifyComponent ],
imports: [
BrowserAnimationsModule,
SharedModule
],
providers: [
LoggerService,
{ provide: DataService, useClass: mockDataService }
]
})
.compileComponents();
}));
@ -22,4 +36,9 @@ describe('CLVerifyComponent', () => {
it('should create', () => {
expect(component).toBeTruthy();
});
afterEach(() => {
TestBed.resetTestingModule();
});
});

View File

@ -10,7 +10,6 @@ import { Location } from '@angular/common';
import { environment, API_URL } from '../../../environments/environment';
import { LoggerService } from '../../shared/services/logger.service';
import { SessionService } from '../../shared/services/session.service';
import { CommonService } from '../../shared/services/common.service';
import { ErrorMessageComponent } from '../../shared/components/data-modal/error-message/error-message.component';
import { CLInvoiceInformationComponent } from '../transactions/invoice-information-modal/invoice-information.component';
import { GetInfo, Fees, Balance, LocalRemoteBalance, Payment, FeeRates, ListInvoices, Invoice, Peer } from '../../shared/models/clModels';
@ -27,12 +26,11 @@ export class CLEffects implements OnDestroy {
private unSubs: Array<Subject<void>> = [new Subject(), new Subject()];
constructor(
private actions$: Actions,
private actions: Actions,
private httpClient: HttpClient,
private store: Store<fromRTLReducer.RTLState>,
private sessionService: SessionService,
private logger: LoggerService,
private commonService: CommonService,
private router: Router,
private location: Location) {
this.store.select('cl')
@ -46,7 +44,7 @@ export class CLEffects implements OnDestroy {
}
infoFetchCL = createEffect(() =>
this.actions$.pipe(
this.actions.pipe(
ofType(CLActions.FETCH_INFO_CL),
withLatestFrom(this.store.select('root')),
mergeMap(([action, store]: [CLActions.FetchInfo, fromRTLReducer.RootState]) => {
@ -54,7 +52,7 @@ export class CLEffects implements OnDestroy {
this.store.dispatch(new CLActions.ClearEffectError('FetchInfo'));
return this.httpClient.get<GetInfo>(this.CHILD_API_URL + environment.GETINFO_API)
.pipe(
takeUntil(this.actions$.pipe(ofType(RTLActions.SET_SELECTED_NODE))),
takeUntil(this.actions.pipe(ofType(RTLActions.SET_SELECTED_NODE))),
map((info) => {
this.logger.info(info);
this.store.dispatch(new RTLActions.CloseSpinner());
@ -90,7 +88,7 @@ export class CLEffects implements OnDestroy {
);
fetchFeesCL = createEffect(() =>
this.actions$.pipe(
this.actions.pipe(
ofType(CLActions.FETCH_FEES_CL),
mergeMap((action: CLActions.FetchFees) => {
this.store.dispatch(new CLActions.ClearEffectError('FetchFees'));
@ -110,7 +108,7 @@ export class CLEffects implements OnDestroy {
);
fetchFeeRatesCL = createEffect(() =>
this.actions$.pipe(
this.actions.pipe(
ofType(CLActions.FETCH_FEE_RATES_CL),
mergeMap((action: CLActions.FetchFeeRates) => {
this.store.dispatch(new CLActions.ClearEffectError('FetchFeeRates'));
@ -130,7 +128,7 @@ export class CLEffects implements OnDestroy {
);
fetchBalanceCL = createEffect(() =>
this.actions$.pipe(
this.actions.pipe(
ofType(CLActions.FETCH_BALANCE_CL),
mergeMap((action: CLActions.FetchBalance) => {
this.store.dispatch(new CLActions.ClearEffectError('FetchBalance'));
@ -150,7 +148,7 @@ export class CLEffects implements OnDestroy {
);
fetchLocalRemoteBalanceCL = createEffect(() =>
this.actions$.pipe(
this.actions.pipe(
ofType(CLActions.FETCH_LOCAL_REMOTE_BALANCE_CL),
mergeMap((action: CLActions.FetchLocalRemoteBalance) => {
this.store.dispatch(new CLActions.ClearEffectError('FetchLocalRemoteBalance'));
@ -170,7 +168,7 @@ export class CLEffects implements OnDestroy {
);
getNewAddressCL = createEffect(() =>
this.actions$.pipe(
this.actions.pipe(
ofType(CLActions.GET_NEW_ADDRESS_CL),
mergeMap((action: CLActions.GetNewAddress) => {
return this.httpClient.get(this.CHILD_API_URL + environment.ON_CHAIN_API + '?type=' + action.payload.addressCode)
@ -190,7 +188,7 @@ export class CLEffects implements OnDestroy {
);
setNewAddressCL = createEffect(() =>
this.actions$.pipe(
this.actions.pipe(
ofType(CLActions.SET_NEW_ADDRESS_CL),
map((action: CLActions.SetNewAddress) => {
this.logger.info(action.payload);
@ -200,7 +198,7 @@ export class CLEffects implements OnDestroy {
);
peersFetchCL = createEffect(() =>
this.actions$.pipe(
this.actions.pipe(
ofType(CLActions.FETCH_PEERS_CL),
mergeMap((action: CLActions.FetchPeers) => {
this.store.dispatch(new CLActions.ClearEffectError('FetchPeers'));
@ -221,7 +219,7 @@ export class CLEffects implements OnDestroy {
);
saveNewPeerCL = createEffect(() =>
this.actions$.pipe(
this.actions.pipe(
ofType(CLActions.SAVE_NEW_PEER_CL),
withLatestFrom(this.store.select('cl')),
mergeMap(([action, clData]: [CLActions.SaveNewPeer, fromCLReducers.CLState]) => {
@ -245,7 +243,7 @@ export class CLEffects implements OnDestroy {
);
detachPeerCL = createEffect(() =>
this.actions$.pipe(
this.actions.pipe(
ofType(CLActions.DETACH_PEER_CL),
mergeMap((action: CLActions.DetachPeer) => {
return this.httpClient.delete(this.CHILD_API_URL + environment.PEERS_API + '/' + action.payload.id + '?force=' + action.payload.force)
@ -267,7 +265,7 @@ export class CLEffects implements OnDestroy {
);
channelsFetchCL = createEffect(() =>
this.actions$.pipe(
this.actions.pipe(
ofType(CLActions.FETCH_CHANNELS_CL),
mergeMap((action: CLActions.FetchChannels) => {
this.store.dispatch(new CLActions.ClearEffectError('FetchChannels'));
@ -290,7 +288,7 @@ export class CLEffects implements OnDestroy {
);
openNewChannelCL = createEffect(() =>
this.actions$.pipe(
this.actions.pipe(
ofType(CLActions.SAVE_NEW_CHANNEL_CL),
mergeMap((action: CLActions.SaveNewChannel) => {
this.store.dispatch(new CLActions.ClearEffectError('SaveNewChannel'));
@ -315,7 +313,7 @@ export class CLEffects implements OnDestroy {
);
updateChannelCL = createEffect(() =>
this.actions$.pipe(
this.actions.pipe(
ofType(CLActions.UPDATE_CHANNELS_CL),
mergeMap((action: CLActions.UpdateChannels) => {
return this.httpClient.post(this.CHILD_API_URL + environment.CHANNELS_API + '/setChannelFee',
@ -341,7 +339,7 @@ export class CLEffects implements OnDestroy {
);
closeChannelCL = createEffect(() =>
this.actions$.pipe(
this.actions.pipe(
ofType(CLActions.CLOSE_CHANNEL_CL),
mergeMap((action: CLActions.CloseChannel) => {
const queryParam = action.payload.force ? '?force=' + action.payload.force : '';
@ -365,7 +363,7 @@ export class CLEffects implements OnDestroy {
);
paymentsFetchCL = createEffect(() =>
this.actions$.pipe(
this.actions.pipe(
ofType(CLActions.FETCH_PAYMENTS_CL),
mergeMap((action: CLActions.FetchPayments) => {
this.store.dispatch(new CLActions.ClearEffectError('FetchPayments'));
@ -385,7 +383,7 @@ export class CLEffects implements OnDestroy {
);
decodePaymentCL = createEffect(() =>
this.actions$.pipe(
this.actions.pipe(
ofType(CLActions.DECODE_PAYMENT_CL),
mergeMap((action: CLActions.DecodePayment) => {
this.store.dispatch(new CLActions.ClearEffectError('DecodePayment'));
@ -411,7 +409,7 @@ export class CLEffects implements OnDestroy {
);
setDecodedPaymentCL = createEffect(() =>
this.actions$.pipe(
this.actions.pipe(
ofType(CLActions.SET_DECODED_PAYMENT_CL),
map((action: CLActions.SetDecodedPayment) => {
this.logger.info(action.payload);
@ -421,7 +419,7 @@ export class CLEffects implements OnDestroy {
);
sendPaymentCL = createEffect(() =>
this.actions$.pipe(
this.actions.pipe(
ofType(CLActions.SEND_PAYMENT_CL),
withLatestFrom(this.store.select('root')),
mergeMap(([action, store]: [CLActions.SendPayment, any]) => {
@ -466,7 +464,7 @@ export class CLEffects implements OnDestroy {
);
queryRoutesFetchCL = createEffect(() =>
this.actions$.pipe(
this.actions.pipe(
ofType(CLActions.GET_QUERY_ROUTES_CL),
mergeMap((action: CLActions.GetQueryRoutes) => {
return this.httpClient.get(this.CHILD_API_URL + environment.NETWORK_API + '/getRoute/' + action.payload.destPubkey + '/' + action.payload.amount)
@ -487,7 +485,7 @@ export class CLEffects implements OnDestroy {
);
setQueryRoutesCL = createEffect(() =>
this.actions$.pipe(
this.actions.pipe(
ofType(CLActions.SET_QUERY_ROUTES_CL),
map((action: CLActions.SetQueryRoutes) => {
return action.payload;
@ -496,7 +494,7 @@ export class CLEffects implements OnDestroy {
);
peerLookupCL = createEffect(() =>
this.actions$.pipe(
this.actions.pipe(
ofType(CLActions.PEER_LOOKUP_CL),
mergeMap((action: CLActions.PeerLookup) => {
this.store.dispatch(new CLActions.ClearEffectError('Lookup'));
@ -519,7 +517,7 @@ export class CLEffects implements OnDestroy {
);
channelLookupCL = createEffect(() =>
this.actions$.pipe(
this.actions.pipe(
ofType(CLActions.CHANNEL_LOOKUP_CL),
mergeMap((action: CLActions.ChannelLookup) => {
this.store.dispatch(new CLActions.ClearEffectError('Lookup'));
@ -547,7 +545,7 @@ export class CLEffects implements OnDestroy {
);
invoiceLookupCL = createEffect(() =>
this.actions$.pipe(
this.actions.pipe(
ofType(CLActions.INVOICE_LOOKUP_CL),
mergeMap((action: CLActions.InvoiceLookup) => {
this.store.dispatch(new CLActions.ClearEffectError('Lookup'));
@ -570,7 +568,7 @@ export class CLEffects implements OnDestroy {
);
setLookupCL = createEffect(() =>
this.actions$.pipe(
this.actions.pipe(
ofType(CLActions.SET_LOOKUP_CL),
map((action: CLActions.SetLookup) => {
this.logger.info(action.payload);
@ -580,7 +578,7 @@ export class CLEffects implements OnDestroy {
);
fetchForwardingHistoryCL = createEffect(() =>
this.actions$.pipe(
this.actions.pipe(
ofType(CLActions.GET_FORWARDING_HISTORY_CL),
mergeMap((action: CLActions.GetForwardingHistory) => {
this.store.dispatch(new CLActions.ClearEffectError('GetForwardingHistory'));
@ -602,7 +600,7 @@ export class CLEffects implements OnDestroy {
);
deleteExpiredInvoiceCL = createEffect(() =>
this.actions$.pipe(
this.actions.pipe(
ofType(CLActions.DELETE_EXPIRED_INVOICE_CL),
mergeMap((action: CLActions.DeleteExpiredInvoice) => {
const queryStr = (action.payload) ? '?maxexpiry=' + action.payload : '';
@ -625,7 +623,7 @@ export class CLEffects implements OnDestroy {
);
saveNewInvoiceCL = createEffect(() =>
this.actions$.pipe(
this.actions.pipe(
ofType(CLActions.SAVE_NEW_INVOICE_CL),
mergeMap((action: CLActions.SaveNewInvoice) => {
this.store.dispatch(new CLActions.ClearEffectError('SaveNewInvoice'));
@ -659,7 +657,7 @@ export class CLEffects implements OnDestroy {
);
invoicesFetchCL = createEffect(() =>
this.actions$.pipe(
this.actions.pipe(
ofType(CLActions.FETCH_INVOICES_CL),
mergeMap((action: CLActions.FetchInvoices) => {
this.store.dispatch(new CLActions.ClearEffectError('FetchInvoices'));
@ -682,7 +680,7 @@ export class CLEffects implements OnDestroy {
);
SetChannelTransactionCL = createEffect(() =>
this.actions$.pipe(
this.actions.pipe(
ofType(CLActions.SET_CHANNEL_TRANSACTION_CL),
mergeMap((action: CLActions.SetChannelTransaction) => {
this.store.dispatch(new CLActions.ClearEffectError('SetChannelTransaction'));
@ -706,7 +704,7 @@ export class CLEffects implements OnDestroy {
);
utxosFetch = createEffect(() =>
this.actions$.pipe(
this.actions.pipe(
ofType(CLActions.FETCH_UTXOS_CL),
mergeMap((action: CLActions.FetchUTXOs) => {
this.store.dispatch(new CLActions.ClearEffectError('FetchUTXOs'));

View File

@ -41,7 +41,7 @@ export class CLCreateInvoiceComponent implements OnInit, OnDestroy {
public invoiceError = '';
private unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject(), new Subject(), new Subject()];
constructor(public dialogRef: MatDialogRef<CLCreateInvoiceComponent>, @Inject(MAT_DIALOG_DATA) public data: InvoiceInformation, private store: Store<fromRTLReducer.RTLState>, private decimalPipe: DecimalPipe, private commonService: CommonService, private actions$: Actions) {}
constructor(public dialogRef: MatDialogRef<CLCreateInvoiceComponent>, @Inject(MAT_DIALOG_DATA) public data: InvoiceInformation, private store: Store<fromRTLReducer.RTLState>, private decimalPipe: DecimalPipe, private commonService: CommonService, private actions: Actions) {}
ngOnInit() {
this.pageSize = this.data.pageSize;
@ -51,7 +51,7 @@ export class CLCreateInvoiceComponent implements OnInit, OnDestroy {
this.selNode = rtlStore.nodeSettings;
this.information = rtlStore.information;
});
this.actions$.pipe(takeUntil(this.unSubs[1]),
this.actions.pipe(takeUntil(this.unSubs[1]),
filter(action => action.type === CLActions.EFFECT_ERROR_CL || action.type === CLActions.ADD_INVOICE_CL))
.subscribe((action: CLActions.EffectError | CLActions.AddInvoice) => {
if (action.type === CLActions.ADD_INVOICE_CL) {

View File

@ -1,14 +1,27 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
import { CommonService } from '../../../shared/services/common.service';
import { LoggerService } from '../../../shared/services/logger.service';
import { CLInvoiceInformationComponent } from './invoice-information.component';
import { mockCommonService, mockMatDialogRef } from '../../../shared/services/test-consts';
import { SharedModule } from '../../../shared/shared.module';
describe('CLInvoiceInformationComponent', () => {
let component: CLInvoiceInformationComponent;
let fixture: ComponentFixture<CLInvoiceInformationComponent>;
beforeEach(async(() => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ CLInvoiceInformationComponent ]
declarations: [ CLInvoiceInformationComponent ],
imports: [ SharedModule ],
providers: [
LoggerService,
{ provide: MatDialogRef, useClass: mockMatDialogRef },
{ provide: MAT_DIALOG_DATA, useValue: {invoice:{}} },
{ provide: CommonService, useClass: mockCommonService }
]
})
.compileComponents();
}));
@ -22,4 +35,9 @@ describe('CLInvoiceInformationComponent', () => {
it('should create', () => {
expect(component).toBeTruthy();
});
afterEach(() => {
TestBed.resetTestingModule();
});
});

View File

@ -1,14 +1,38 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { StoreModule } from '@ngrx/store';
import { RTLReducer } from '../../../store/rtl.reducers';
import { CommonService } from '../../../shared/services/common.service';
import { CLQueryRoutesComponent } from './query-routes.component';
import { mockCLEffects, mockCommonService, mockECLEffects, mockLNDEffects, mockRTLEffects } from '../../../shared/services/test-consts';
import { CLEffects } from '../../store/cl.effects';
import { EffectsModule } from '@ngrx/effects';
import { SharedModule } from '../../../shared/shared.module';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
describe('CLQueryRoutesComponent', () => {
let component: CLQueryRoutesComponent;
let fixture: ComponentFixture<CLQueryRoutesComponent>;
beforeEach(async(() => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ CLQueryRoutesComponent ]
declarations: [ CLQueryRoutesComponent ],
imports: [
BrowserAnimationsModule,
SharedModule,
StoreModule.forRoot(RTLReducer, {
runtimeChecks: {
strictStateImmutability: false,
strictActionImmutability: false
}
}),
EffectsModule.forRoot([mockRTLEffects, mockLNDEffects, mockCLEffects, mockECLEffects])
],
providers: [
{ provide: CLEffects, useClass: mockCLEffects },
{ provide: CommonService, useClass: mockCommonService }
]
})
.compileComponents();
}));
@ -22,4 +46,9 @@ describe('CLQueryRoutesComponent', () => {
it('should create', () => {
expect(component).toBeTruthy();
});
afterEach(() => {
TestBed.resetTestingModule();
});
});

View File

@ -15,7 +15,6 @@ import { CommonService } from '../../../shared/services/common.service';
import { LoggerService } from '../../../shared/services/logger.service';
import { CLEffects } from '../../store/cl.effects';
import { RTLEffects } from '../../../store/rtl.effects';
import * as CLActions from '../../store/cl.actions';
import * as RTLActions from '../../../store/rtl.actions';
import * as fromRTLReducer from '../../../store/rtl.reducers';
@ -47,7 +46,7 @@ export class CLLightningSendPaymentsComponent implements OnInit, OnDestroy {
public isCompatibleVersion = false;
private unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject(), new Subject()];
constructor(public dialogRef: MatDialogRef<CLLightningSendPaymentsComponent>, private store: Store<fromRTLReducer.RTLState>, private clEffects: CLEffects, private logger: LoggerService, private commonService: CommonService, private decimalPipe: DecimalPipe, private actions$: Actions, private rtlEffects: RTLEffects) {}
constructor(public dialogRef: MatDialogRef<CLLightningSendPaymentsComponent>, private store: Store<fromRTLReducer.RTLState>, private clEffects: CLEffects, private logger: LoggerService, private commonService: CommonService, private decimalPipe: DecimalPipe, private actions: Actions) {}
ngOnInit() {
this.store.select('cl')
@ -60,7 +59,7 @@ export class CLLightningSendPaymentsComponent implements OnInit, OnDestroy {
&& this.commonService.isVersionCompatible(rtlStore.information.api_version, '0.4.0');
this.logger.info(rtlStore);
});
this.actions$.pipe(takeUntil(this.unSubs[1]),
this.actions.pipe(takeUntil(this.unSubs[1]),
filter(action => action.type === CLActions.EFFECT_ERROR_CL || action.type === CLActions.SEND_PAYMENT_STATUS_CL))
.subscribe((action: CLActions.EffectError | CLActions.SendPaymentStatus) => {
if (action.type === CLActions.SEND_PAYMENT_STATUS_CL) {

View File

@ -1,14 +1,39 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { StoreModule } from '@ngrx/store';
import { RTLReducer } from '../../store/rtl.reducers';
import { LoggerService } from '../../shared/services/logger.service';
import { CLTransactionsComponent } from './transactions.component';
import { SharedModule } from '../../shared/shared.module';
import { CLQueryRoutesComponent } from './query-routes/query-routes.component';
import { mockCommonService } from '../../shared/services/test-consts';
import { CommonService } from '../../shared/services/common.service';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
describe('CLTransactionsComponent', () => {
let component: CLTransactionsComponent;
let fixture: ComponentFixture<CLTransactionsComponent>;
beforeEach(async(() => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ CLTransactionsComponent ]
declarations: [ CLTransactionsComponent, CLQueryRoutesComponent ],
imports: [
BrowserAnimationsModule,
SharedModule,
RouterTestingModule,
StoreModule.forRoot(RTLReducer, {
runtimeChecks: {
strictStateImmutability: false,
strictActionImmutability: false
}
})
],
providers: [
LoggerService,
{ provide: CommonService, useClass: mockCommonService }
]
})
.compileComponents();
}));
@ -22,4 +47,9 @@ describe('CLTransactionsComponent', () => {
it('should create', () => {
expect(component).toBeTruthy();
});
afterEach(() => {
TestBed.resetTestingModule();
});
});

View File

@ -1,4 +1,5 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { SharedModule } from '../../../shared/shared.module';
import { ECLBalancesInfoComponent } from './balances-info.component';
@ -6,9 +7,10 @@ describe('ECLBalancesInfoComponent', () => {
let component: ECLBalancesInfoComponent;
let fixture: ComponentFixture<ECLBalancesInfoComponent>;
beforeEach(async(() => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ ECLBalancesInfoComponent ]
declarations: [ ECLBalancesInfoComponent ],
imports: [ SharedModule ]
})
.compileComponents();
}));
@ -22,4 +24,9 @@ describe('ECLBalancesInfoComponent', () => {
it('should create', () => {
expect(component).toBeTruthy();
});
afterEach(() => {
TestBed.resetTestingModule();
});
});

View File

@ -2,14 +2,14 @@
<div fxLayout="column" fxFlex="9" fxLayoutAlign="end start">
<span class="dashboard-capacity-header this-channel-capacity">Total Capacity</span>
<div fxLayout="row" fxLayoutAlign="space-between start" class="w-100">
<mat-hint fxFlex="40" fxLayoutAlign="start center" class="font-size-90"><strong class="font-weight-900 mr-5px">Local:</strong>{{channelBalances.localBalance || 0 | number:'1.0-0'}} Sats</mat-hint>
<mat-hint fxFlex="40" fxLayoutAlign="start center" class="font-size-90"><strong class="font-weight-900 mr-5px">Local:</strong>{{channelBalances?.localBalance || 0 | number:'1.0-0'}} Sats</mat-hint>
<mat-hint fxFlex="20" fxLayoutAlign="center center" class="font-size-90">
<fa-icon [icon]="faBalanceScale" class="mr-3px" matTooltip="Balance Score"></fa-icon>
({{channelBalances?.balancedness || 0 | number}})
</mat-hint>
<mat-hint fxFlex="40" fxLayoutAlign="end center" class="font-size-90"><strong class="font-weight-900 mr-5px">Remote:</strong>{{channelBalances.remoteBalance || 0 | number:'1.0-0'}} Sats</mat-hint>
<mat-hint fxFlex="40" fxLayoutAlign="end center" class="font-size-90"><strong class="font-weight-900 mr-5px">Remote:</strong>{{channelBalances?.remoteBalance || 0 | number:'1.0-0'}} Sats</mat-hint>
</div>
<mat-progress-bar class="dashboard-progress-bar this-channel-bar" mode="determinate" color="accent" value="{{channelBalances.localBalance && channelBalances.localBalance > 0 ? ((+channelBalances.localBalance/((+channelBalances.localBalance)+(+channelBalances.remoteBalance)))*100) : 0}}"></mat-progress-bar>
<mat-progress-bar class="dashboard-progress-bar this-channel-bar" mode="determinate" color="accent" value="{{channelBalances?.localBalance && channelBalances?.localBalance > 0 ? ((+channelBalances?.localBalance/((+channelBalances?.localBalance)+(+channelBalances?.remoteBalance)))*100) : 0}}"></mat-progress-bar>
</div>
<div fxLayout="column" fxFlex="3" fxLayoutAlign="end stretch"><mat-divider class="dashboard-divider"></mat-divider></div>
<div class="channels-capacity-scroll" [perfectScrollbar]>

View File

@ -1,4 +1,6 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { SharedModule } from '../../../shared/shared.module';
import { ECLChannelCapacityInfoComponent } from './channel-capacity-info.component';
@ -6,9 +8,10 @@ describe('ECLChannelCapacityInfoComponent', () => {
let component: ECLChannelCapacityInfoComponent;
let fixture: ComponentFixture<ECLChannelCapacityInfoComponent>;
beforeEach(async(() => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ ECLChannelCapacityInfoComponent ]
declarations: [ ECLChannelCapacityInfoComponent ],
imports: [ SharedModule, RouterTestingModule ]
})
.compileComponents();
}));
@ -22,4 +25,9 @@ describe('ECLChannelCapacityInfoComponent', () => {
it('should create', () => {
expect(component).toBeTruthy();
});
afterEach(() => {
TestBed.resetTestingModule();
});
});

View File

@ -1,14 +1,25 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { CommonService } from '../../../shared/services/common.service';
import { mockCommonService } from '../../../shared/services/test-consts';
import { SharedModule } from '../../../shared/shared.module';
import { ECLChannelLiquidityInfoComponent } from './channel-liquidity-info.component';
describe('ECLChannelLiquidityInfoComponent', () => {
let component: ECLChannelLiquidityInfoComponent;
let fixture: ComponentFixture<ECLChannelLiquidityInfoComponent>;
beforeEach(async(() => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ ECLChannelLiquidityInfoComponent ]
declarations: [ ECLChannelLiquidityInfoComponent ],
imports: [ SharedModule, RouterTestingModule ],
providers: [
{ provide: CommonService, useClass: mockCommonService }
]
})
.compileComponents();
}));
@ -22,4 +33,9 @@ describe('ECLChannelLiquidityInfoComponent', () => {
it('should create', () => {
expect(component).toBeTruthy();
});
afterEach(() => {
TestBed.resetTestingModule();
});
});

View File

@ -1,4 +1,4 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { ECLChannelStatusInfoComponent } from './channel-status-info.component';
@ -6,7 +6,7 @@ describe('ECLChannelStatusInfoComponent', () => {
let component: ECLChannelStatusInfoComponent;
let fixture: ComponentFixture<ECLChannelStatusInfoComponent>;
beforeEach(async(() => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ ECLChannelStatusInfoComponent ]
})
@ -22,4 +22,9 @@ describe('ECLChannelStatusInfoComponent', () => {
it('should create', () => {
expect(component).toBeTruthy();
});
afterEach(() => {
TestBed.resetTestingModule();
});
});

View File

@ -1,4 +1,4 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { ECLFeeInfoComponent } from './fee-info.component';
@ -6,7 +6,7 @@ describe('ECLFeeInfoComponent', () => {
let component: ECLFeeInfoComponent;
let fixture: ComponentFixture<ECLFeeInfoComponent>;
beforeEach(async(() => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ ECLFeeInfoComponent ]
})
@ -22,4 +22,9 @@ describe('ECLFeeInfoComponent', () => {
it('should create', () => {
expect(component).toBeTruthy();
});
afterEach(() => {
TestBed.resetTestingModule();
});
});

View File

@ -1,14 +1,44 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { StoreModule } from '@ngrx/store';
import { RTLReducer } from '../../store/rtl.reducers';
import { CommonService } from '../../shared/services/common.service';
import { LoggerService } from '../../shared/services/logger.service';
import { ECLHomeComponent } from './home.component';
import { mockCLEffects, mockCommonService, mockECLEffects, mockLNDEffects, mockRTLEffects } from '../../shared/services/test-consts';
import { EffectsModule } from '@ngrx/effects';
import { SharedModule } from '../../shared/shared.module';
import { ECLNodeInfoComponent } from './node-info/node-info.component';
import { ECLBalancesInfoComponent } from './balances-info/balances-info.component';
import { ECLChannelCapacityInfoComponent } from './channel-capacity-info/channel-capacity-info.component';
import { ECLFeeInfoComponent } from './fee-info/fee-info.component';
import { ECLChannelStatusInfoComponent } from './channel-status-info/channel-status-info.component';
describe('ECLHomeComponent', () => {
let component: ECLHomeComponent;
let fixture: ComponentFixture<ECLHomeComponent>;
beforeEach(async(() => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ ECLHomeComponent ]
declarations: [ ECLHomeComponent, ECLNodeInfoComponent, ECLBalancesInfoComponent, ECLChannelCapacityInfoComponent, ECLFeeInfoComponent, ECLChannelStatusInfoComponent ],
imports: [
SharedModule,
RouterTestingModule,
StoreModule.forRoot(RTLReducer, {
runtimeChecks: {
strictStateImmutability: false,
strictActionImmutability: false
}
}),
EffectsModule.forRoot([mockRTLEffects, mockLNDEffects, mockCLEffects, mockECLEffects])
],
providers: [
LoggerService,
{ provide: CommonService, useClass: mockCommonService }
]
})
.compileComponents();
}));
@ -22,4 +52,9 @@ describe('ECLHomeComponent', () => {
it('should create', () => {
expect(component).toBeTruthy();
});
afterEach(() => {
TestBed.resetTestingModule();
});
});

View File

@ -54,7 +54,7 @@ export class ECLHomeComponent implements OnInit, OnDestroy {
public flgLoading: Array<Boolean | 'error'> = [true, true, true, true, true, true, true, true]; // 0: Info, 1: Fee, 2: Wallet, 3: Channel, 4: Network
private unSubs: Array<Subject<void>> = [new Subject(), new Subject(), new Subject()];
constructor(private logger: LoggerService, private store: Store<fromRTLReducer.RTLState>, private actions$: Actions, private commonService: CommonService, private router: Router) {
constructor(private logger: LoggerService, private store: Store<fromRTLReducer.RTLState>, private actions: Actions, private commonService: CommonService, private router: Router) {
this.screenSize = this.commonService.getScreenSize();
if(this.screenSize === ScreenSizeEnum.XS) {
this.operatorCards = [
@ -160,7 +160,7 @@ export class ECLHomeComponent implements OnInit, OnDestroy {
}
this.logger.info(rtlStore);
});
this.actions$.pipe(takeUntil(this.unSubs[2]),
this.actions.pipe(takeUntil(this.unSubs[2]),
filter((action) => action.type === ECLActions.FETCH_FEES_ECL || action.type === ECLActions.SET_FEES_ECL))
.subscribe(action => {
if(action.type === ECLActions.FETCH_FEES_ECL) {

View File

@ -2,20 +2,20 @@
<div>
<h4 class="dashboard-info-title">Alias</h4>
<div class="overflow-wrap dashboard-info-value">
{{information.alias}}
<span *ngIf="!showColorFieldSeparately" class="dashboard-node-dot dot" [ngStyle]="{'backgroundColor': information.color}"></span>
{{information?.alias}}
<span *ngIf="!showColorFieldSeparately" class="dashboard-node-dot dot" [ngStyle]="{'backgroundColor': information?.color}"></span>
</div>
</div>
<div *ngIf="showColorFieldSeparately">
<h4 class="dashboard-info-title">Color</h4>
<div class="overflow-wrap dashboard-info-value">
<span class="dashboard-node-square" [ngStyle]="{'backgroundColor': information.color}"></span>
{{information.color | uppercase}}
<span class="dashboard-node-square" [ngStyle]="{'backgroundColor': information?.color}"></span>
{{information?.color | uppercase}}
</div>
</div>
<div>
<h4 class="dashboard-info-title">Implementation</h4>
<div class="overflow-wrap dashboard-info-value">{{(information.lnImplementation || information.version) ? information.lnImplementation + ' ' + information.version : ''}}</div>
<div class="overflow-wrap dashboard-info-value">{{(information?.lnImplementation || information?.version) ? information?.lnImplementation + ' ' + information?.version : ''}}</div>
</div>
<div>
<h4 class="dashboard-info-title">Chain</h4>

View File

@ -1,14 +1,21 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { CommonService } from '../../../shared/services/common.service';
import { mockCommonService } from '../../../shared/services/test-consts';
import { ECLNodeInfoComponent } from './node-info.component';
describe('ECLNodeInfoComponent', () => {
let component: ECLNodeInfoComponent;
let fixture: ComponentFixture<ECLNodeInfoComponent>;
beforeEach(async(() => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ ECLNodeInfoComponent ]
declarations: [ ECLNodeInfoComponent ],
providers: [
{ provide: CommonService, useClass: mockCommonService }
]
})
.compileComponents();
}));
@ -22,4 +29,9 @@ describe('ECLNodeInfoComponent', () => {
it('should create', () => {
expect(component).toBeTruthy();
});
afterEach(() => {
TestBed.resetTestingModule();
});
});

View File

@ -1,14 +1,39 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { StoreModule } from '@ngrx/store';
import { RTLReducer } from '../../store/rtl.reducers';
import { CommonService } from '../../shared/services/common.service';
import { LoggerService } from '../../shared/services/logger.service';
import { ECLLookupsComponent } from './lookups.component';
import { mockCLEffects, mockCommonService, mockECLEffects, mockLNDEffects, mockRTLEffects } from '../../shared/services/test-consts';
import { EffectsModule } from '@ngrx/effects';
import { SharedModule } from '../../shared/shared.module';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
describe('ECLLookupsComponent', () => {
let component: ECLLookupsComponent;
let fixture: ComponentFixture<ECLLookupsComponent>;
beforeEach(async(() => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ ECLLookupsComponent ]
declarations: [ ECLLookupsComponent ],
imports: [
BrowserAnimationsModule,
SharedModule,
StoreModule.forRoot(RTLReducer, {
runtimeChecks: {
strictStateImmutability: false,
strictActionImmutability: false
}
}),
EffectsModule.forRoot([mockRTLEffects, mockLNDEffects, mockCLEffects, mockECLEffects])
],
providers: [
LoggerService,
{ provide: CommonService, useClass: mockCommonService }
]
})
.compileComponents();
}));
@ -22,4 +47,9 @@ describe('ECLLookupsComponent', () => {
it('should create', () => {
expect(component).toBeTruthy();
});
afterEach(() => {
TestBed.resetTestingModule();
});
});

View File

@ -40,12 +40,12 @@ export class ECLLookupsComponent implements OnInit, OnDestroy {
public screenSizeEnum = ScreenSizeEnum;
private unSubs: Array<Subject<void>> = [new Subject(), new Subject()];
constructor(private logger: LoggerService, private commonService: CommonService, private store: Store<fromRTLReducer.RTLState>, private actions$: Actions) {
constructor(private logger: LoggerService, private commonService: CommonService, private store: Store<fromRTLReducer.RTLState>, private actions: Actions) {
this.screenSize = this.commonService.getScreenSize();
}
ngOnInit() {
this.actions$.pipe(takeUntil(this.unSubs[0]),
this.actions.pipe(takeUntil(this.unSubs[0]),
filter((action) => (action.type === ECLActions.SET_LOOKUP_ECL || action.type === ECLActions.EFFECT_ERROR_ECL))).subscribe((resLookup: ECLActions.SetLookup | ECLActions.EffectError) => {
if(resLookup.type === ECLActions.SET_LOOKUP_ECL) {
this.flgLoading[0] = true;

View File

@ -3,25 +3,25 @@
<div fxLayout="row">
<div fxFlex="100">
<h4 fxLayoutAlign="start" class="font-bold-500">Pub Key</h4>
<span class="foreground-secondary-text w-100">{{lookupResult.nodeId}}</span>
<span class="foreground-secondary-text w-100">{{lookupResult?.nodeId}}</span>
</div>
</div>
<mat-divider [inset]="true" class="my-1"></mat-divider>
<div fxLayout="row">
<div fxFlex="100">
<h4 fxLayoutAlign="start" class="font-bold-500">Signature</h4>
<span class="foreground-secondary-text">{{lookupResult.signature}}</span>
<span class="foreground-secondary-text">{{lookupResult?.signature}}</span>
</div>
</div>
<mat-divider [inset]="true" class="my-1"></mat-divider>
<div fxLayout="row">
<div fxFlex="50">
<h4 fxLayoutAlign="start" class="font-bold-500">Alias</h4>
<span class="foreground-secondary-text">{{lookupResult.alias}}<span class="ml-2" [ngStyle]="{'background-color': lookupResult.rgbColor}">{{lookupResult.rgbColor ? lookupResult.rgbColor : ''}}</span></span>
<span class="foreground-secondary-text">{{lookupResult?.alias}}<span class="ml-2" [ngStyle]="{'background-color': lookupResult?.rgbColor}">{{lookupResult?.rgbColor ? lookupResult?.rgbColor : ''}}</span></span>
</div>
<div fxFlex="50">
<h4 fxLayoutAlign="start" class="font-bold-500">Date/Time</h4>
<span class="foreground-secondary-text">{{(lookupResult.timestamp * 1000) | date:'dd/MMM/YYYY HH:mm'}}</span>
<span class="foreground-secondary-text">{{(lookupResult?.timestamp * 1000) | date:'dd/MMM/YYYY HH:mm'}}</span>
</div>
</div>
<div fxLayout="column" class="mt-2">
@ -36,7 +36,7 @@
<th mat-header-cell *matHeaderCellDef class="pl-1"><span fxLayoutAlign="end center">Actions</span></th>
<td mat-cell *matCellDef="let address" class="pl-1">
<span fxLayoutAlign="end center">
<button mat-stroked-button color="primary" type="button" tabindex="1" rtlClipboard [payload]="lookupResult.nodeId + '@' + address" (copied)="onCopyNodeURI($event)">Copy Node URI</button>
<button mat-stroked-button color="primary" type="button" tabindex="1" rtlClipboard [payload]="lookupResult?.nodeId + '@' + address" (copied)="onCopyNodeURI($event)">Copy Node URI</button>
</span>
</td>
</ng-container>

View File

@ -1,4 +1,8 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { waitForAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { LoggerService } from '../../../shared/services/logger.service';
import { SharedModule } from '../../../shared/shared.module';
import { ECLNodeLookupComponent } from './node-lookup.component';
@ -6,9 +10,14 @@ describe('ECLNodeLookupComponent', () => {
let component: ECLNodeLookupComponent;
let fixture: ComponentFixture<ECLNodeLookupComponent>;
beforeEach(async(() => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [ ECLNodeLookupComponent ]
declarations: [ ECLNodeLookupComponent ],
imports: [
BrowserAnimationsModule,
SharedModule
],
providers: [ LoggerService ]
})
.compileComponents();
}));
@ -22,4 +31,9 @@ describe('ECLNodeLookupComponent', () => {
it('should create', () => {
expect(component).toBeTruthy();
});
afterEach(() => {
TestBed.resetTestingModule();
});
});

View File

@ -13,7 +13,7 @@ import { LoggerService } from '../../../shared/services/logger.service';
})
export class ECLNodeLookupComponent implements OnInit {
@ViewChild(MatSort, { static: false }) sort: MatSort|undefined;
@Input() lookupResult: LookupNode;
@Input() lookupResult: LookupNode = {};
public addresses: any;
public displayedColumns = ['address', 'actions'];

Some files were not shown because too many files have changed in this diff Show More