Skip to content

Instantly share code, notes, and snippets.

@lusarz
lusarz / test.js
Created April 6, 2019 08:40
Mocking backend in vue component
// ArticlesDAO
import axios from 'axios';
export function findAll () {
axios.get('/api/articles');
}
// ArticlesList.spec.js
@lusarz
lusarz / testing.js
Created April 6, 2019 08:26
Build vuex store in unit tests
import { shallowMount } from '@vue/test-utils';
import Vuex from 'vuex';
import Form from 'components/form';
export function buildStores (stores) {
const modules = {};
stores.forEach(config => {
modules[config.name] = {
namespaced: true,