# @belsrc/vue-test-functional-wrapper

> Wrap a functional component in order to test against it

Latest version **1.0.1** (published 2019-06-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install @belsrc/vue-test-functional-wrapper
pnpm add @belsrc/vue-test-functional-wrapper
yarn add @belsrc/vue-test-functional-wrapper
bun add @belsrc/vue-test-functional-wrapper
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2019-06-17 |
| First published | 2019-06-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | bryan@bryanckizer.com |
| Maintainers | belsrc |
| Keywords | vue, unit testing, testing, test, functional component, component |

## Links

- npm: https://www.npmjs.com/package/@belsrc/vue-test-functional-wrapper
- Repository: https://github.com/belsrc/vue-test-functional-wrapper
- Homepage: https://github.com/belsrc/vue-test-functional-wrapper#readme
- Issues: https://github.com/belsrc/vue-test-functional-wrapper/issues
- npm.io page: https://npm.io/package/@belsrc/vue-test-functional-wrapper

## Alternatives

- [duck](https://npm.io/package/duck.md) — 4.2M weekly downloads
- [ava](https://npm.io/package/ava.md) — 560.2K weekly downloads
- [storybook-addon-module-mock](https://npm.io/package/storybook-addon-module-mock.md) — 71.7K weekly downloads
- [@ethereum-waffle/mock-contract](https://npm.io/package/@ethereum-waffle/mock-contract.md) — 40.0K weekly downloads
- [aws-elasticsearch-connector](https://npm.io/package/aws-elasticsearch-connector.md) — 37.4K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2019-06-17
- 1.0.0 — 2019-06-15

## README

# vue-test-functional-wrapper

[![Build Status](https://img.shields.io/travis/belsrc/vue-test-functional-wrapper.svg?style=flat-square)](https://travis-ci.org/belsrc/vue-test-functional-wrapper)
[![Maintainability](https://img.shields.io/codeclimate/maintainability/belsrc/vue-test-functional-wrapper.svg?style=flat-square)](https://codeclimate.com/github/belsrc/vue-test-functional-wrapper/maintainability)
[![Code Coverage](https://img.shields.io/codecov/c/github/belsrc/vue-test-functional-wrapper/master.svg?style=flat-square)](https://codecov.io/gh/belsrc/vue-test-functional-wrapper/branch/master)
[![Known Vulnerabilities](https://img.shields.io/snyk/vulnerabilities/github/belsrc/vue-test-functional-wrapper.svg?style=flat-square)](https://app.snyk.io/org/belsrc/project/0623bc36-ba88-4751-b85c-6f93c28b5f7c)
[![Last Commit](https://img.shields.io/github/last-commit/belsrc/vue-test-functional-wrapper/master.svg?style=flat-square)](https://github.com/belsrc/vue-test-functional-wrapper/commits/master)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](https://github.com/belsrc/vue-test-functional-wrapper/pulls)



## Install

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

## Use

```js
// 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](LICENCE)

---
_Source: https://npm.io/package/@belsrc/vue-test-functional-wrapper · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
