Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
@Action
fetchCountDelta() {
this.context.commit('incrCount', 5)
}
@Action({ rawError: true })
async incrCountAction(payload: number) {
const context = this.context
await this.context.dispatch('getCountDelta')
expect(this.context).to.equal(context)
}
}
const store = new Vuex.Store({
modules: {
mm: MyModule
}
})
describe('dispatching action which mutates works', () => {
it('should update count', async function() {
await store.dispatch('getCountDelta')
expect(parseInt(store.state.mm.count)).to.equal(5)
})
it('should update count (sync)', async function() {
store.dispatch('fetchCountDelta')
expect(parseInt(store.state.mm.count)).to.equal(10)
})
})
city: Validity.INCOMPLETE,
country: Validity.VALID,
addressType: Validity.VALID,
receiptOptOut: Validity.VALID
}
},
actions = {
validateInput: jest.fn(),
storeAddressFields: jest.fn()
}
getters = {
validity: () => jest.fn(),
invalidFields: jest.fn(),
allFieldsAreValid: jest.fn()
}
store = new Vuex.Store({
state,
actions,
getters
});
})
import Vue from 'vue'
import Vuex from 'vuex'
import Cookies from 'js-cookie'
import routerData from './modules/routerData'
import role from './modules/role'
import layout from './modules/layout/index'
Vue.use(Vuex)
const store = new Vuex.Store({
state: {
token: Cookies.get('token')
},
mutations: {
setToken (state, token) {
state.token = token
Cookies.set('token', token ,{ expires: 1/24 });
}
},
actions: {
setToken ({commit}, token) {
return new Promise((resolve, reject) => {
commit('setToken', token)
resolve()
})
}
import packageJson from '../../package.json'
import {
filteredAndSorted,
groupByDate,
filteredUsingSearchQuery
} from '../../lib/tab-group-helpers'
Vue.use(Vuex)
const chromep = new ChromePromise()
export const THEMES = ['dark', 'light']
export const POST_TIDY_BEHAVIORS = ['dashboard', 'new-tab']
export const TAB_GROUP_VIEWS = ['default', 'group-by-date']
const store = new Vuex.Store({
state: {
version: packageJson.version,
stateVersion: packageJson.version.split('.')[0],
data: {
tabGroups: []
},
searchQuery: '',
theme: '',
bookmarkFolderId: null,
postTidyBehavior: null,
silentlyRejectDuplicates: null,
tabGroupView: null
},
actions: {
async SAVE_TAB_GROUP (
export default function () {
const Store = new Vuex.Store({
modules: {
showcase,
layoutDemo
}
})
if (process.env.DEV && module.hot) {
module.hot.accept(['./showcase'], () => {
const newShowcase = require('./showcase').default
Store.hotUpdate({ modules: { showcase: newShowcase } })
})
module.hot.accept(['./layoutDemo'], () => {
const newLayoutDemo = require('./layoutDemo').default
Store.hotUpdate({ modules: { layoutDemo: newLayoutDemo } })
})
}
import Vue from 'vue';
import Vuex, { Store } from 'vuex';
import { isDev } from 'common';
import { ApplicationUpdatesModule } from './application-updates/application-updates-module';
import { DevicesModule } from './devices/devices-module';
import { HeartbeatsModule } from './heartbeats/heartbeats-module';
import { IRootState } from './i-root-state';
Vue.use(Vuex);
export const store = new Store({
modules: {
applicationUpdates: new ApplicationUpdatesModule(),
devices: new DevicesModule(),
heartbeats: new HeartbeatsModule(),
},
strict: isDev(),
});
Vue.use(VueRouter)
Vue.use(iView)
Vue.use(Vuex)
Vue.use(Util)
Vue.prototype.$echarts = echarts
Vue.prototype.makehl = function(str) {
var value = hljs.highlightAuto(str);
return value.value
}
const router = new VueRouter({
routes: route
})
const store = new Vuex.Store({
state:{
init : false,
currentEnv : null,
envs : [],
user:'',
staredJdbcrefs:[],
staredShards:[],
staredJdbcrefDtos:[],
staredShardDtos:[]
},
getters: {},
mutations: {
},
actions: {}
})
const createComponent = () => {
store = new Vuex.Store({
modules: {
terminalSync: {
namespaced: true,
state: moduleState,
mutations: {
[START_LOADING]: (state) => {
state.isLoading = true;
},
},
},
},
});
wrapper = shallowMount(TerminalSyncStatus, {
localVue,
store,
function createComponent({ data = {} } = {}) {
const store = new Vuex.Store({
state: {
packageEntity,
nugetPath,
},
getters: {
npmInstallationCommand,
npmSetupCommand,
},
});
wrapper = shallowMount(NpmInstallation, {
localVue,
store,
data() {
return data;
},