mirror of
https://github.com/lana-k/sqliteviz.git
synced 2025-12-06 18:18:53 +08:00
lint fixes
This commit is contained in:
@@ -18,7 +18,7 @@ describe('Schema.vue', () => {
|
|||||||
const store = new Vuex.Store({ state })
|
const store = new Vuex.Store({ state })
|
||||||
|
|
||||||
// mout the component
|
// mout the component
|
||||||
const wrapper = mount(Schema, { store, localVue})
|
const wrapper = mount(Schema, { store, localVue })
|
||||||
|
|
||||||
// check DB name and schema visibility
|
// check DB name and schema visibility
|
||||||
expect(wrapper.find('.db-name').text()).to.equal('fooDB')
|
expect(wrapper.find('.db-name').text()).to.equal('fooDB')
|
||||||
@@ -33,7 +33,7 @@ describe('Schema.vue', () => {
|
|||||||
const store = new Vuex.Store({ state })
|
const store = new Vuex.Store({ state })
|
||||||
|
|
||||||
// mout the component
|
// mout the component
|
||||||
const wrapper = mount(Schema, { store, localVue})
|
const wrapper = mount(Schema, { store, localVue })
|
||||||
|
|
||||||
// click and check visibility
|
// click and check visibility
|
||||||
await wrapper.find('.db-name').trigger('click')
|
await wrapper.find('.db-name').trigger('click')
|
||||||
@@ -73,7 +73,7 @@ describe('Schema.vue', () => {
|
|||||||
const store = new Vuex.Store({ state })
|
const store = new Vuex.Store({ state })
|
||||||
|
|
||||||
// mount the component
|
// mount the component
|
||||||
const wrapper = mount(Schema, { store, localVue})
|
const wrapper = mount(Schema, { store, localVue })
|
||||||
|
|
||||||
// apply filters and check the list of tables
|
// apply filters and check the list of tables
|
||||||
await wrapper.find('#schema-filter input').setValue('foo')
|
await wrapper.find('#schema-filter input').setValue('foo')
|
||||||
@@ -81,7 +81,7 @@ describe('Schema.vue', () => {
|
|||||||
expect(tables).to.have.lengthOf(2)
|
expect(tables).to.have.lengthOf(2)
|
||||||
expect(tables.at(0).vm.name).to.equal('foo')
|
expect(tables.at(0).vm.name).to.equal('foo')
|
||||||
expect(tables.at(1).vm.name).to.equal('foobar')
|
expect(tables.at(1).vm.name).to.equal('foobar')
|
||||||
|
|
||||||
await wrapper.find('#schema-filter input').setValue('bar')
|
await wrapper.find('#schema-filter input').setValue('bar')
|
||||||
tables = wrapper.findAllComponents(TableDescription)
|
tables = wrapper.findAllComponents(TableDescription)
|
||||||
expect(tables).to.have.lengthOf(2)
|
expect(tables).to.have.lengthOf(2)
|
||||||
@@ -125,12 +125,12 @@ describe('Schema.vue', () => {
|
|||||||
const store = new Vuex.Store({ state, mutations })
|
const store = new Vuex.Store({ state, mutations })
|
||||||
|
|
||||||
// stub getFileFromUser
|
// stub getFileFromUser
|
||||||
const file = { file: 'hello'}
|
const file = { file: 'hello' }
|
||||||
sinon.stub(fu, 'getFileFromUser').resolves(file)
|
sinon.stub(fu, 'getFileFromUser').resolves(file)
|
||||||
|
|
||||||
// mock $db.loadDb()
|
// mock $db.loadDb()
|
||||||
const newSchema = {
|
const newSchema = {
|
||||||
dbName: 'barDB',
|
dbName: 'barDB',
|
||||||
schema: [
|
schema: [
|
||||||
{
|
{
|
||||||
name: 'bar',
|
name: 'bar',
|
||||||
@@ -158,16 +158,16 @@ describe('Schema.vue', () => {
|
|||||||
sinon.spy($db, 'loadDb')
|
sinon.spy($db, 'loadDb')
|
||||||
|
|
||||||
// mount the component
|
// mount the component
|
||||||
const wrapper = mount(Schema, { store, localVue, mocks: {$db}})
|
const wrapper = mount(Schema, { store, localVue, mocks: { $db } })
|
||||||
|
|
||||||
// trigger the event
|
// trigger the event
|
||||||
await wrapper.find('#db-edit').trigger('click')
|
await wrapper.find('#db-edit').trigger('click')
|
||||||
|
|
||||||
expect(fu.getFileFromUser.calledOnceWith('.db,.sqlite,.sqlite3')).to.equal(true)
|
expect(fu.getFileFromUser.calledOnceWith('.db,.sqlite,.sqlite3')).to.equal(true)
|
||||||
|
|
||||||
await fu.getFileFromUser.returnValues[0]
|
await fu.getFileFromUser.returnValues[0]
|
||||||
expect($db.loadDb.calledOnceWith(file)).to.equal(true)
|
expect($db.loadDb.calledOnceWith(file)).to.equal(true)
|
||||||
|
|
||||||
await $db.loadDb.returnValues[0]
|
await $db.loadDb.returnValues[0]
|
||||||
expect(mutations.saveSchema.calledOnceWith(state, newSchema)).to.equal(true)
|
expect(mutations.saveSchema.calledOnceWith(state, newSchema)).to.equal(true)
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user