SimonTestNet / SimonTest

Repository for SimonTest questions and issues https://simontest.net
16 stars 2 forks source link

Cannot read property 'length' of undefined #25

Closed prabhat112 closed 5 years ago

prabhat112 commented 5 years ago

VS code version:1.31.1 SimonTest:1.1.0 Angular:6.0.3

Getting error when I run the generate tests command

//Below Component TS

import { Component, OnInit, OnDestroy, ChangeDetectionStrategy, AfterContentChecked } from '@angular/core'; import { Observable } from 'rxjs'; import { Store, select } from '@ngrx/store'; import { AppState } from 'app/core/store'; import * as fromStore from 'app/core/store'; import { Entitlements } from 'app/core/model/entitlements'; import { MasterUserList, IRUserList, FXUserList } from 'app/shared/constants/constants';

@Component({ selector: 'fph-dashboard', templateUrl: './dashboard.component.html', styleUrls: ['./dashboard.component.css'], changeDetection: ChangeDetectionStrategy.OnPush }) export class DashboardComponent implements OnInit, OnDestroy, AfterContentChecked { paymentQueueCount$: Observable; exceptionQueueCount$: Observable; inprocessQueueCount$: Observable; processedQueueCount$: Observable; ofacQueueCount$: Observable; investigationQueueCount$: Observable; remittanceQueueCount$: Observable; MasterUserList = MasterUserList; IRUserList = IRUserList; FXUserList = FXUserList; currentUser: Entitlements; dashboardQueueTile: boolean[] = [ false, false, false, false, false, false, false, false ]; // [PayQ, ExcQ, InpQ, ProcQ, OfacQ, InvQ, IRQ]

constructor(private store: Store) {} ngOnInit() { }

ngAfterContentChecked() { this.currentUser = JSON.parse(localStorage.getItem('currentUser')); this.displayDashboardTiles(); this.getWebsocketCounts(); } getWebsocketCounts() { this.paymentQueueCount$ = this.store.pipe( select(fromStore.getPaymentQueueCount$) ); this.exceptionQueueCount$ = this.store.pipe( select(fromStore.getExceptionQueueCount$) ); this.inprocessQueueCount$ = this.store.pipe( select(fromStore.getInprocessQueueCount$) ); this.processedQueueCount$ = this.store.pipe( select(fromStore.getProcessedQueueCount$) ); this.ofacQueueCount$ = this.store.pipe( select(fromStore.getOfacQueueCount$) ); this.investigationQueueCount$ = this.store.pipe( select(fromStore.getInvestigationQueueCount$) ); this.remittanceQueueCount$ = this.store.pipe( select(fromStore.getRemittanceQueueCount$) ); } ngOnDestroy() {} displayDashboardTiles() { if (this.FXUserList.includes(this.currentUser.roleConstant)) { this.dashboardQueueTile = [ false, true, true, true, true, true, true, false ]; // [IRQ, PayQ, ExcQ, InpQ, ProcQ, OfacQ, InvQ, IRQ] } else if (this.IRUserList.includes(this.currentUser.roleConstant)) { this.dashboardQueueTile = [ true, false, true, true, true, true, false, false ]; } else if (this.MasterUserList.includes(this.currentUser.roleConstant)) { this.dashboardQueueTile = [ false, true, true, true, true, true, true, true ]; } } }

ManuelDeLeon commented 5 years ago

Thx for reporting it. Pick up v1.1.1

prabhat112 commented 5 years ago

Thanks. That worked!