To properly test Vue you must create a Vue instance , previously configured. That is, in the test file, we upload the necessary files to run the tests:
let Vue = require('vue')
let expect = require('chai').expect
const plugin = require('../src/plugin/index')
We configure Vue, in this example, so that it does not send the advice
mensajeVue.config.productionTip = false
Vue.use(plugin)
and we proceed to create the instance of vue
let vm = new Vue()
In this instance the plugin is already there and we can do the tests that we have designed, for example:
describe('El archivo plugin', function () {
it('debe existir', function () {
expect(plugin).to.not.be.undefined
})
it('debe estar instalado', () => {
expect(plugin.installed).to.be.true
})
it('debe tener la propiedad $acreditar', () => {
expect(vm.$acreditar).to.not.be.undefined
})
it('debe tener la propiedad version', () => {
const version = '0.1.0'
expect(vm.$acreditar.version).to.equal('0.1.0')
})
})