1.0.1 • Published 5 years ago

@belsrc/vue-test-functional-wrapper v1.0.1

Weekly downloads
25
License
MIT
Repository
github
Last release
5 years ago

vue-test-functional-wrapper

Build Status Maintainability Code Coverage Known Vulnerabilities Last Commit PRs Welcome

Install

npm i -D @belsrc/vue-test-functional-wrapper

Use

// functional-component.test.js
import wrapFunctional from '@belsrc/vue-test-functional-wrapper';
import FunctionalComponent from './functional-component';

let wrapped;

describe('FunctionalComponent', () => {
  beforeEach(() => {
    wrapped = wrapFunctional(FunctionalComponent, {
      methods: { click() { this.$emit('click'); } },
      on(vm) { return { click: vm.click } },
    });
  });

  describe('Rendering', () => {
    test('should do somthing', () => {
      const wrapper = mount(wrapped, {
        propsData: { foo: 'bar' },
      });

      ...
    });
  });
});

LICENCE

MIT