I try to write test cases for this Super Report Component where i provided all the required services and routers and when I execute my test cases i wil get not get any result no success aur error message. i.e here i get this message Executed 0 of 285 DISCONNECTED .
describe('SuperReportsComponent', () => {
let component: SuperReportsComponent;
let navigationService: NavigationService;
let appService: AppService;
let reportService: ReportsService;
let reportAction = ReportActions;
let router: Router;
let route: ActivatedRoute;
let store: Store<AppState>;
let fixture: ComponentFixture<SuperReportsComponent>;
const MockRouter = {
navigate: jasmine.createSpy('navigate')
};
const MockActivatedRoute = {};
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [SuperReportsComponent],
imports: [NgCircleProgressModule.forRoot({}),
NgbPopoverModule,
HeaderModule,
StoreModule.forRoot(rootReducer),
HttpModule,
CommonModule,
FormsModule,
NgbModule.forRoot()],
providers: [
ReportActions,
AppService,
ReportsService,
NavigationService,
NotificationService,
WebsocketService,
SharedLayoutService,
SuperdashService,
{provide: Router, useValue: MockRouter},
{provide: ActivatedRoute, useValue: MockActivatedRoute}
]
})
.compileComponents();
}));
beforeEach(() => {
route = TestBed.get(ActivatedRoute);
router = TestBed.get(Router);
navigationService = TestBed.get(NavigationService);
appService = TestBed.get(AppService);
reportService = TestBed.get(ReportsService);
reportAction = TestBed.get(ReportActions);
store = TestBed.get(Store);
fixture = TestBed.createComponent(SuperReportsComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
Here I mock the navigate method and provide all the services with its required modules but didn't get any output.
OUTPUT:
Chrome 69.0.3497 (Linux 0.0.0) ERROR Chrome 69.0.3497 (Linux 0.0.0) ERROR Disconnected, because no message in 10000 ms. Chrome 69.0.3497 (Linux 0.0.0): Executed 0 of 285 DISCONNECTED (10 secs / 0 secs)
Aucun commentaire:
Enregistrer un commentaire