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'

 

posted @ 2019-02-02 15:39  巫瞅瞅  阅读(185)  评论(0编辑  收藏  举报