const { transformTemplate } = require('../lib/mp-weixin/transform/template-transformer') function assertCodegen(wxmlCode, vueCode) { expect(transformTemplate(wxmlCode)[0]).toBe(vueCode) } describe('wxml:compiler', () => { it('generate event', () => { assertCodegen( ``, `` ) assertCodegen( ``, `` ) }) it('generate class', () => { assertCodegen( ``, `` ) }) it('generate v-if', () => { assertCodegen( '{{ item.name }}', `{{ item.name }}` ) }) it('generate v-for', () => { assertCodegen( '', `` ) assertCodegen( '', `` ) assertCodegen( '', `` ) assertCodegen( '', `` ) }) it('generate root element', () => { assertCodegen( '', `` ) assertCodegen( ` `, `` ) assertCodegen( '', `` ) }) })