# @paliari/vue-test-utils

> JS test utils

Latest version **0.0.13** (published 2019-05-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install @paliari/vue-test-utils
pnpm add @paliari/vue-test-utils
yarn add @paliari/vue-test-utils
bun add @paliari/vue-test-utils
```

## Health

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

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.13 |
| Published | 2019-05-14 |
| First published | 2018-12-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Felipe Bohnert Paetzold |
| Maintainers | dflourusso, felipebohnertpaetzold, m.paliari, paliari_ci |

## Links

- npm: https://www.npmjs.com/package/@paliari/vue-test-utils
- npm.io page: https://npm.io/package/@paliari/vue-test-utils

## Recent versions

- 0.0.13 (latest) — 2019-05-14
- 0.0.12 — 2018-12-10
- 0.0.11 — 2018-12-10
- 0.0.10 — 2018-12-07
- 0.0.6 — 2018-12-07
- 0.0.5 — 2018-12-07
- 0.0.4 — 2018-12-07
- 0.0.3 — 2018-12-07
- 0.0.2 — 2018-12-07
- 0.0.1 — 2018-12-07

## README

# vue-test-utils

#Install
- Use npm
    
    ```$ npm install -D @paliari/vue-test-utils --save```
- Use yarn

    ```$ yarn add -D @paliari/vue-test-utils```

## Mocks
#### StoreHelpers

With this it is possible to mock the paliari vue store helper methods (base, paginator, crud)
    
Usage sample:
```javascript
import '@paliari/vue-test-utils/__mocks__/StoreHelpers'
import paliariVue from 'paliari-vue'
import 'store/modules/anyStore'
import api from './__mocks__/api'

const { StoreHelpers } = paliariVue

it('should to call the auxiliary store with the correct parameters', () => {
    expect(StoreHelper.base).toBeCalledTimes(1)
    expect(StoreHelper.base).toBeCalledWith({ namespaced: true }, api)
})
```

---

#### Filters

Mocks of the main filters used in the projects
    
Usage sample:
```javascript
import { shallowMount } from '@vue/test-utils'
import { filters } from '@paliari/vue-test-utils'
import Component from '@/views/Zubumafu.vue'

describe('renderer', () => {
    it('should matched snapshot', () => {
        const wrapper = shallowMount(Component, { filters })
        expect(wrapper.element).toMatchSnapshot()
    })
    it('should to call filter cpfCnpj', () => {
        expect(filters.cpfCnpj).toBeCalledTimes(1)
        expect(filters.cpfCnpj).toBeCalledWith('00000000000')
    })
})
```
    
Single imports sample:
```javascript
import { cpfCnpj, truncate, date } from '@paliari/vue-test-utils/__mocks__/filters'
```
    
Available filters
    
|  name    | params                              | returns                             |
|----------|-------------------------------------|-------------------------------------|
| cpfCnpj  |   (value)                           |    v                                |
| currency |   (number, prefix = '', sufix = '') |   `${prefix}${number}${sufix}`      |
|  date    |  (value, format)                    |    value                            |
| truncate |  (text, length = 30)                |`text.substr(0, length - 3) + '...'` |

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