mirror of
https://github.com/lana-k/sqliteviz.git
synced 2025-12-07 02:28:54 +08:00
increase timeout for tests;
fix warnings in tests
This commit is contained in:
@@ -16,7 +16,8 @@ describe('DbUploader.vue', () => {
|
||||
// mock store state and mutations
|
||||
state = {}
|
||||
mutations = {
|
||||
saveSchema: sinon.stub()
|
||||
saveSchema: sinon.stub(),
|
||||
setDb: sinon.stub()
|
||||
}
|
||||
store = new Vuex.Store({ state, mutations })
|
||||
})
|
||||
@@ -563,7 +564,8 @@ describe('DbUploader.vue import CSV', () => {
|
||||
let resolveImport = sinon.stub()
|
||||
const newDb = {
|
||||
createDb: sinon.stub().resolves(new Promise(resolve => { resolveImport = resolve })),
|
||||
createProgressCounter: sinon.stub().returns(1)
|
||||
createProgressCounter: sinon.stub().returns(1),
|
||||
deleteProgressCounter: sinon.stub()
|
||||
}
|
||||
sinon.stub(database, 'getNewDatabase').returns(newDb)
|
||||
|
||||
@@ -812,7 +814,8 @@ describe('DbUploader.vue import CSV', () => {
|
||||
const newDb = {
|
||||
createDb: sinon.stub().resolves(schema),
|
||||
createProgressCounter: sinon.stub().returns(1),
|
||||
deleteProgressCounter: sinon.stub()
|
||||
deleteProgressCounter: sinon.stub(),
|
||||
shutDown: sinon.stub()
|
||||
}
|
||||
sinon.stub(database, 'getNewDatabase').returns(newDb)
|
||||
|
||||
@@ -832,6 +835,7 @@ describe('DbUploader.vue import CSV', () => {
|
||||
expect(actions.addTab.called).to.equal(false)
|
||||
expect(mutations.setCurrentTabId.called).to.equal(false)
|
||||
expect($router.push.called).to.equal(false)
|
||||
expect(newDb.shutDown.calledOnce).to.equal(true)
|
||||
expect(wrapper.find('[data-modal="parse"]').exists()).to.equal(false)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -19,6 +19,7 @@ describe('TableDescription.vue', () => {
|
||||
|
||||
it('Columns are visible and correct when click on table name', async () => {
|
||||
const wrapper = shallowMount(TableDescription, {
|
||||
stubs: ['router-link'],
|
||||
propsData: {
|
||||
name: 'Test table',
|
||||
columns: [
|
||||
|
||||
@@ -6,6 +6,10 @@ import Vuex from 'vuex'
|
||||
import Tabs from '@/components/Tabs.vue'
|
||||
|
||||
describe('Tabs.vue', () => {
|
||||
afterEach(() => {
|
||||
sinon.restore()
|
||||
})
|
||||
|
||||
it('Renders start guide when there is no opened tabs', () => {
|
||||
// mock store state
|
||||
const state = {
|
||||
@@ -14,7 +18,10 @@ describe('Tabs.vue', () => {
|
||||
const store = new Vuex.Store({ state })
|
||||
|
||||
// mount the component
|
||||
const wrapper = shallowMount(Tabs, { store })
|
||||
const wrapper = shallowMount(Tabs, {
|
||||
store,
|
||||
stubs: ['router-link']
|
||||
})
|
||||
|
||||
// check start-guide visibility
|
||||
expect(wrapper.find('#start-guide').isVisible()).to.equal(true)
|
||||
@@ -32,7 +39,10 @@ describe('Tabs.vue', () => {
|
||||
const store = new Vuex.Store({ state })
|
||||
|
||||
// mount the component
|
||||
const wrapper = shallowMount(Tabs, { store })
|
||||
const wrapper = shallowMount(Tabs, {
|
||||
store,
|
||||
stubs: ['router-link']
|
||||
})
|
||||
|
||||
// check start-guide visibility
|
||||
expect(wrapper.find('#start-guide').isVisible()).to.equal(false)
|
||||
@@ -64,7 +74,10 @@ describe('Tabs.vue', () => {
|
||||
const store = new Vuex.Store({ state, mutations })
|
||||
|
||||
// mount the component
|
||||
const wrapper = shallowMount(Tabs, { store })
|
||||
const wrapper = shallowMount(Tabs, {
|
||||
store,
|
||||
stubs: ['router-link']
|
||||
})
|
||||
|
||||
// click on the first tab
|
||||
const firstTab = wrapper.findAll('.tab').at(0)
|
||||
@@ -90,7 +103,10 @@ describe('Tabs.vue', () => {
|
||||
const store = new Vuex.Store({ state, mutations })
|
||||
|
||||
// mount the component
|
||||
const wrapper = mount(Tabs, { store, stubs: ['router-link'] })
|
||||
const wrapper = mount(Tabs, {
|
||||
store,
|
||||
stubs: ['router-link']
|
||||
})
|
||||
|
||||
// click on the close icon of the first tab
|
||||
const firstTabCloseIcon = wrapper.findAll('.tab').at(0).find('.close-icon')
|
||||
@@ -118,7 +134,10 @@ describe('Tabs.vue', () => {
|
||||
const store = new Vuex.Store({ state, mutations })
|
||||
|
||||
// mount the component
|
||||
const wrapper = mount(Tabs, { store, stubs: ['router-link'] })
|
||||
const wrapper = mount(Tabs, {
|
||||
store,
|
||||
stubs: ['router-link']
|
||||
})
|
||||
|
||||
// click on the close icon of the second tab
|
||||
const secondTabCloseIcon = wrapper.findAll('.tab').at(1).find('.close-icon')
|
||||
@@ -156,7 +175,10 @@ describe('Tabs.vue', () => {
|
||||
const store = new Vuex.Store({ state, mutations })
|
||||
|
||||
// mount the component
|
||||
const wrapper = mount(Tabs, { store, stubs: ['router-link'] })
|
||||
const wrapper = mount(Tabs, {
|
||||
store,
|
||||
stubs: ['router-link']
|
||||
})
|
||||
|
||||
// click on the close icon of the second tab
|
||||
const secondTabCloseIcon = wrapper.findAll('.tab').at(1).find('.close-icon')
|
||||
@@ -198,7 +220,10 @@ describe('Tabs.vue', () => {
|
||||
const store = new Vuex.Store({ state, mutations })
|
||||
|
||||
// mount the component
|
||||
const wrapper = mount(Tabs, { store, stubs: ['router-link'] })
|
||||
const wrapper = mount(Tabs, {
|
||||
store,
|
||||
stubs: ['router-link']
|
||||
})
|
||||
|
||||
// click on the close icon of the second tab
|
||||
const secondTabCloseIcon = wrapper.findAll('.tab').at(1).find('.close-icon')
|
||||
@@ -243,7 +268,10 @@ describe('Tabs.vue', () => {
|
||||
const store = new Vuex.Store({ state, mutations })
|
||||
|
||||
// mount the component
|
||||
const wrapper = shallowMount(Tabs, { store })
|
||||
const wrapper = shallowMount(Tabs, {
|
||||
store,
|
||||
stubs: ['router-link']
|
||||
})
|
||||
|
||||
const event = new Event('beforeunload')
|
||||
sinon.spy(event, 'preventDefault')
|
||||
@@ -264,7 +292,10 @@ describe('Tabs.vue', () => {
|
||||
const store = new Vuex.Store({ state, mutations })
|
||||
|
||||
// mount the component
|
||||
const wrapper = shallowMount(Tabs, { store })
|
||||
const wrapper = shallowMount(Tabs, {
|
||||
store,
|
||||
stubs: ['router-link']
|
||||
})
|
||||
|
||||
const event = new Event('beforeunload')
|
||||
sinon.spy(event, 'preventDefault')
|
||||
|
||||
Reference in New Issue
Block a user