admin-fe/test/views/mediaProxyCache/index.test.js
Angelina Filippova e1b9ccdef1 First green test
2020-11-29 20:52:45 +03:00

40 lines
937 B
JavaScript

import Vuex from 'vuex'
import { mount, createLocalVue, config } from '@vue/test-utils'
import flushPromises from 'flush-promises'
import Element from 'element-ui'
import MediaProxyCache from '@/views/mediaProxyCache/index'
import storeConfig from './store.conf'
import { cloneDeep } from 'lodash'
config.mocks["$t"] = () => {}
const localVue = createLocalVue()
localVue.use(Vuex)
localVue.use(Element)
jest.mock('@/api/app')
jest.mock('@/api/nodeInfo')
jest.mock('@/api/mediaProxyCache')
jest.mock('@/api/settings')
describe('', () => {
let store
beforeEach(() => {
store = new Vuex.Store(cloneDeep(storeConfig))
})
it('fetches initial list of urls', async (done) => {
const wrapper = mount(MediaProxyCache, {
store,
localVue,
sync: false
})
await flushPromises()
console.log(store.state)
console.log(wrapper.html())
expect(wrapper.vm.urlsCount).toEqual(2)
done()
})
})