Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
describe('fab-cantainer.vue', () => {
const localVue = createLocalVue()
localVue.use(index)
let wrapper = null
beforeEach(() => {
// 初始化wrapper
wrapper = mount(FabCantainer, {
localVue
})
jasmine.DEFAULT_TIMEOUT_INTERVAL = 999999;
})
it('startAnimate', (done) => {
let timeout = new Timeout()
expect(wrapper.vm.touching).toBe(false)
expect(wrapper.vm.animating).toBe(false)
expect(wrapper.vm.mousedown).toBe(false)
import { mount, createLocalVue } from 'vue-test-utils'
import assert from 'assert'
import sinon from 'sinon'
import TopPage from 'src/pages/TopPage'
const localVue = createLocalVue()
describe('TopPage', function () {
const $router = { push: () => sinon.stub() }
it('renders button(s)', function () {
const wrapper = mount(TopPage, { localVue })
const buttons = wrapper.vm.buttons
const wrapperArray = wrapper.findAll('.button')
for (let [index, element] of wrapperArray.wrappers.entries()) {
assert(element.text() === buttons[index].text)
}
})
describe('push()', function () {
it('adds "is-loading" class on clicked button', function () {
const wrapper = mount(TopPage, { localVue, mocks: { $router } })
import 'babel-polyfill'
import { mount, createLocalVue } from 'vue-test-utils'
import Vuex from 'vuex'
import Vuetify from 'vuetify'
import QueueData from '@/components/QueueData'
import * as mtype from '@/store/mutation-types'
import store from '@/store'
import Fixtures from './fixtures/QueueData'
const localVue = createLocalVue()
localVue.use(Vuex)
localVue.use(Vuetify)
describe('QueueData', () => {
beforeEach(() => {
store.commit(mtype.CLEAR_QUEUES_LIST)
store.commit(mtype.SET_SELECTED_QUEUE, '')
})
it('shows message when not selected', () => {
const comp = mount(QueueData, { store, localVue })
expect(comp.contains('.members')).to.equal(false)
expect(comp.contains('.callers')).to.equal(false)
expect(comp.contains('.block-header')).to.equal(false)
})
import Vuex from 'vuex'
import { mount, createLocalVue } from 'vue-test-utils'
import Counter from 'components/Counter'
import createStore from 'store'
import * as types from 'store/types'
const localVue = createLocalVue()
localVue.use(Vuex)
describe('Counter component unit tests', () => {
let store
beforeEach(() => {
store = createStore()
})
it('should have three buttons', () => {
const wrapper = mount(Counter, { store, localVue })
expect(wrapper.findAll('button').length).toBe(3)
})
it('should have 0 as a default counter value', () => {
import { mount, createLocalVue } from 'vue-test-utils'
import assert from 'assert'
import sinon from 'sinon'
import SearchPage from 'src/pages/SearchPage'
const localVue = createLocalVue()
describe('SearchPage', function () {
const $router = { push: () => sinon.stub() }
it('renders button(s)', function () {
const wrapper = mount(SearchPage, { localVue })
const buttons = wrapper.vm.buttons
const wrapperArray = wrapper.findAll('.button')
for (let [index, element] of wrapperArray.wrappers.entries()) {
assert(element.text() === buttons[index].text)
}
})
describe('push()', function () {
it('adds "is-loading" class on clicked button', function () {
const wrapper = mount(SearchPage, { localVue, mocks: { $router } })
import 'babel-polyfill'
import { mount, createLocalVue } from 'vue-test-utils'
import Vuex from 'vuex'
import Vuetify from 'vuetify'
import sinon from 'sinon'
import * as mtype from '@/store/mutation-types'
import store from '@/store'
import Fixtures from './fixtures/MenuPanel'
import MenuPanel from '@/components/MenuPanel'
const localVue = createLocalVue()
localVue.use(Vuex)
localVue.use(Vuetify)
describe('MenuPanel', () => {
beforeEach(() => {
store.commit(mtype.CLEAR_QUEUES_LIST)
store.commit(mtype.CLEAR_AMISRV_LIST)
})
it('show only one pagination when less queues then perPage param', () => {
Fixtures.sixQueues.forEach(msg => store.dispatch('newMessage', msg))
const comp = mount(MenuPanel, { store, localVue })
expect(comp.findAll('.pagination__item').length).to.equal(1)
})
import { createLocalVue, shallow } from "vue-test-utils";
import Vuex from "vuex";
import Settings from "@/components/Settings";
import Grid from "@/components/Grid";
import * as fs from "fs";
const localVue = createLocalVue();
localVue.use(Vuex);
describe("Settings.vue", () => {
let store;
let wrapper;
let mutations;
let actions;
beforeEach(() => {
mutations = {
UPDATE_SETTING: sinon.stub()
};
actions = {
addProject: sinon.spy()
};
import { mount, createLocalVue } from 'vue-test-utils'
import Vuex from 'vuex'
import assert from 'assert'
import sinon from 'sinon'
import { Xhr } from 'api/index'
import SearchUserPage from 'src/pages/SearchUserPage'
const localVue = createLocalVue()
localVue.use(Vuex)
describe('SearchUserPage', function () {
const store = new Vuex.Store({
modules: {
Auth: {
namespaced: true,
state: { token: '' },
},
},
})
const users = [
{
avatar_url: 'https://avatars2.githubusercontent.com/u/3705391?v=4',
login: 're-fort',
import { mount, createLocalVue } from 'vue-test-utils'
import Vuex from 'vuex'
import assert from 'assert'
import App from 'src/App'
import AuthModule from 'src/store/modules/Auth'
import { stubComponent } from 'tests/unit/stubs/component'
const localVue = createLocalVue()
localVue.use(Vuex)
describe('App', function () {
const routerView = stubComponent.create('router-view')
const routerLink = stubComponent.create('router-link')
Vue.component(routerView.name, routerView)
Vue.component(routerLink.name, routerLink)
//delete mounted hook, because it contains methods to need a stub
delete App.created
const authStore = {
namespaced: true,
mutations: AuthModule.mutations,
getters: AuthModule.getters,
import { shallow, createLocalVue } from "vue-test-utils";
import ProjectService from "@/components/Dashboard/ProjectService";
import Vuex from "vuex";
const localVue = createLocalVue();
localVue.use(Vuex);
describe("ProjectService.vue", () => {
let wrapper;
let store;
beforeEach(() => {
store = new Vuex.Store({
state: {},
getters: {
projectLogFilters: () => () => [],
projectActiveTab: () => () => "logs"
}
});
wrapper = shallow(ProjectService, {