vue and jest测试

Posted cai-yu-candice

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了vue and jest测试相关的知识,希望对你有一定的参考价值。

测试Vue的filters方法:

局部:

import Page from ‘../src/Page‘

  it(‘filter‘, () => {
    const case = Page.filters.toLowerCase(‘HI‘)
    expect(case).toBe(‘hi‘)
  })

全局:

Vue.options.filters.toLowerCase(‘HI‘).toBe(‘hi‘)
在其他测试页面中只需引入filter即可
eg: import {toLowerCase} from ‘filters/index‘

 



以上是关于vue and jest测试的主要内容,如果未能解决你的问题,请参考以下文章