mercredi 18 novembre 2015

how to do a mock test with polymer

I have a function, is a function of polymer web component custom.

    getListDedications: function(e){
            var idDate = e.model.__data__.date.data.id;
            var checkId = function(element){
              return element.id == idDate;
            };
            var responseID = this.dedications.filter(checkId);
            this.data = JSON.stringify(responseID[0].entries) || [];
            console.log(JSON.stringify(responseID[0].entries) || []);
    }
This function return a array or an array empty.

I want to test it, I'm using web-component-tester and I run the tests with gulp test:local. I know that I need to mock e.model.__data__.date.data.id but I do not know how

Aucun commentaire:

Enregistrer un commentaire