const compiler = require('../lib') function assertCodegen (template, templateCode, renderCode = 'with(this){}', options = {}) { const res = compiler.compile(template, { resourcePath: 'test.qxml', mp: Object.assign({ minified: true, isTest: true, platform: 'quickapp-light' }, options) }) expect(res.template).toBe(templateCode) expect(res.render).toBe(renderCode) } describe('mp:compiler-quickapp-light', () => { it('generate v-for directive', () => { assertCodegen( '', '' ) }) it('generate v-else-if with v-else directive', () => { assertCodegen( 'helloworldbye', 'helloworldbye' ) }) })