vendredi 4 septembre 2015

Directive data testing that actually its match the mock data?

I am trying to test directive data with jasmine unit test,my test gets failed how can i test this here is the how i define it in directive:

     chartColor = d3.scale.ordinal().domain(['Passed', 'failed', 'Errors']).range(['#1ea6e0', '#fbb111', '#eb4626']),

In Spec file:

 it('should match the color', function () {
      var testcolor = ['#1ea6e0', '#fbb111', '#eb4626'];
      expect($scope.chartColor).toBe(testcolor);
    });

Error received:

 Expected undefined to be [ '#1ea6e0', '#fbb111', '#eb4626' ].

i want to match the color and there pattern of occurrence in directive as well how can i achieve this?

Aucun commentaire:

Enregistrer un commentaire