mardi 15 août 2017

Karma test won't create new instance of component

I have written a simple test for my Angular component that checks my component toBeTruthy(). When I run it I get the error: 'TypeError: Cannot read property 'params' of undefined at new SomeComponent...'

import { SomeComponent } from './assembly.component';

describe('SomeComponent', () => {
    let component: SomeComponent;

    let mockDynamicTemplateBuilder;
    let mockActivatedRoute;
    let mockINavigationService;
    let mockISiteConfigRetrievalService;

    beforeEach( () => {
        component = new SomeComponent(mockDynamicTemplateBuilder, mockActivatedRoute, mockINavigationService, mockISiteConfigRetrievalService);
    });

    describe('create the component', () => {

        it('component should be truthy', () => {

            expect(component).toBeTruthy();
        });
    });
});

It seem that is is not creating a new instance of my component...I think...? What am I missing?

Aucun commentaire:

Enregistrer un commentaire