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