vue-test-utils setTimeout

时间:2018-09-20 06:21:45

标签: javascript vue-test-utils

我有一个组件,在安装时应每30秒调用一次方法。我无法为此编写单元测试。能否请您分享下面的单元测试示例

methods: {
loadMethod () {
  getData().then(response => {
    this.myArr = response.data
  });
}   },   mounted: function () {
var self = this;
this.loadMethod();
var loadMethod = function () {
  self.loadMethod();
  self.interval1 = setTimeout(loadMethod, 30000);
};
self.interval2 = setTimeout(loadMethod, 30000);   }

0 个答案:

没有答案