Encountering an issue while testing with karma jasmine, the error message appears as...
TypeError: Cannot read property '_id' of undefined
This is the Component.ts file:
import { Component, OnInit } from '@angular/core';
import { ApiService } from '../../../services/api.service';
import { Router } from '@angular/router';
import { NgxSpinnerService } from "ngx-spinner";
import { ToasterConfig } from 'angular2-toaster';
import { NbComponentStatus, NbGlobalPhysicalPosition, NbToastrService } from '@nebular/theme';
import { ToastrService } from 'ngx-toastr';
@Component({
selector: 'ngx-edit-subscription',
templateUrl: './edit-subscription.component.html',
styleUrls: ['./edit-subscription.component.scss']
})
export class EditSubscriptionComponent implements OnInit {
// Component properties and methods go here
}
And this is the Spec.ts file:
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
// Additional imports go here
describe('EditSubscriptionComponent', () => {
let component: EditSubscriptionComponent;
let fixture: ComponentFixture<EditSubscriptionComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
// Configuration details for testing environment
})
.compileComponents();
}));
beforeEach(() => {
// Create test fixture and component instance
});
it('should create', () => {
// Test case to check if component is created successfully
});
});
Thank you.......................................................................................................................................................................................................................