lundi 4 juillet 2016

Unit Test to see if class methods are defined

I simply want to test if my class methods are 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.

Aucun commentaire:

Enregistrer un commentaire