mercredi 6 juin 2018

zone.js:192 Uncaught TypeError: Cannot read property 'alarmdesc' of null

Please, I have a problem that I don't understand why?!

I tried to test a function like:

    it('should call service.AlarmTypeGetById when onEditAlarms', done => {

        const mock = [];

        spyOn(component['as'], 'AlarmTypeGetById').and.callThrough()

        component['as'].AlarmTypeGetById('7').subscribe(ss => {

            console.log(ss.alarmtype_id) // show correct

            console.log(ss.alarmtype_id) //show 7

            expect(ss.alarmtype_id).toEqual(7);

            done();

        });

        component.populateFormAlarm();

    })

In console show this error:

zone.js:192 Uncaught TypeError: Cannot read property 'alarmdesc' of

null

 and in web:

[object ErrorEvent] thrown

Please I need your help.

Aucun commentaire:

Enregistrer un commentaire