angular - Unit Test to see if class methods are defined -


i want test if class methods defined, e.g.:

export class goalsettingspage {      public goal: goal;      constructor(     ) {         this.goal = this.navparams.get('goal');     }      saveform(event) {         this.viewctrl.dismiss(this.goal);     } 

unit test sth like:

xit('should have methods defined', () => {      let g = new goal()     let np = new navparams()     let vc = new viewcontroller()     let e = new events()     let fb = new formbuilder()      let settingmodal = new goalsettingspage(np,vc,fb,e);      expect (settingmodal.saveform(e).tobedefined; }) 

isn't working.

to test existence of method in class instance should be

expect(settingmodal.saveform).tobedefined() 

or, more precisely,

expect(settingmodal.saveform).tobe(jasmine.any(function)); 

Comments

Popular posts from this blog

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -