Sunday, 20 December 2020

Unable to pass arguments to button methods in jasmine using vue and moment

here i have a vue js application where i am trying to unit test the application using jasmine/karma below is the code i have in vue component

methods: {
    dateFilter(date) {
      return moment.unix(date).utc().format("HH:mm a");
    },
}

in the template


After using v-for=(data,index) from database im setting data.date
 <p class="date">
      
 </p>

Now can i test these like whether a give data is in proper format or not right now i wrote some thing like this in the spec file

import { mount } from '@vue/test-utils';
import moment from 'moment'


 it('should call method', () => {
    const selector = wrapper.find('date');
 
  });

Now How can i call the method and pass a mock parameter to test the method can we also import the moment js ?



from Unable to pass arguments to button methods in jasmine using vue and moment

No comments:

Post a Comment