1
0
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:
lana-k
2021-02-11 16:48:37 +01:00
parent 840f4fa450
commit f6c7c9283e
4 changed files with 83 additions and 83 deletions

View File

@@ -3,9 +3,9 @@ import { mount } from '@vue/test-utils'
import SqlEditor from '@/components/SqlEditor.vue'
describe('SqlEditor.vue', () => {
it('Emits input event when a query is changed', async() => {
it('Emits input event when a query is changed', async () => {
const wrapper = mount(SqlEditor)
await wrapper.findComponent({ name: 'codemirror'}).vm.$emit('input', 'SELECT * FROM foo')
await wrapper.findComponent({ name: 'codemirror' }).vm.$emit('input', 'SELECT * FROM foo')
expect(wrapper.emitted('input')[0]).to.eql(['SELECT * FROM foo'])
})
})

View File

@@ -73,7 +73,7 @@ describe('Tab.vue', () => {
expect(wrapper.findComponent({ ref: 'chart' }).vm.visible).to.equal(true)
})
it("Is not visible when not active", async () => {
it('Is not visible when not active', async () => {
// mock store state
const state = {
currentTabId: 0
@@ -93,7 +93,7 @@ describe('Tab.vue', () => {
expect(wrapper.find('.tab-content-container').isVisible()).to.equal(false)
})
it("Calls setCurrentTab when becomes active", async () => {
it('Calls setCurrentTab when becomes active', async () => {
// mock store state
const state = {
currentTabId: 0
@@ -150,7 +150,7 @@ describe('Tab.vue', () => {
const store = new Vuex.Store({ state, mutations })
const $db = {
execute() { return new Promise(() => {}) }
execute () { return new Promise(() => {}) }
}
// mount the component
const wrapper = mount(Tab, {
@@ -183,7 +183,7 @@ describe('Tab.vue', () => {
const store = new Vuex.Store({ state, mutations })
const $db = {
execute() { return Promise.reject('There is no table foo') }
execute () { return Promise.reject('There is no table foo') }
}
// mount the component
const wrapper = mount(Tab, {
@@ -216,7 +216,7 @@ describe('Tab.vue', () => {
const store = new Vuex.Store({ state, mutations })
const result = ['this is table result']
const $db = {
execute() { return Promise.resolve(result) }
execute () { return Promise.resolve(result) }
}
// mount the component
const wrapper = mount(Tab, {

View File

@@ -97,7 +97,7 @@ describe('Tabs.vue', () => {
await firstTabCloseIcon.trigger('click')
// check that the only one tab left and it's opened
expect(wrapper.findAllComponents({name: 'Tab'})).to.have.lengthOf(1)
expect(wrapper.findAllComponents({ name: 'Tab' })).to.have.lengthOf(1)
const firstTab = wrapper.findAll('.tab').at(0)
expect(firstTab.text()).to.include('Untitled')

View File

@@ -27,7 +27,7 @@ describe('hint.js', () => {
// mock showHint and editor
sinon.stub(CM, 'showHint')
const editor = {
getTokenAt() {
getTokenAt () {
return {
string: 'SELECT',
type: 'keyword'
@@ -36,7 +36,7 @@ describe('hint.js', () => {
getCursor: sinon.stub()
}
const clock = sinon.useFakeTimers();
const clock = sinon.useFakeTimers()
hint.show(editor)
clock.tick(500)
@@ -53,7 +53,7 @@ describe('hint.js', () => {
// mock showHint and editor
sinon.stub(CM, 'showHint')
const editor = {
getTokenAt() {
getTokenAt () {
return {
string: 'foo',
type: 'string'
@@ -75,7 +75,7 @@ describe('hint.js', () => {
// mock showHint and editor
sinon.stub(CM, 'showHint')
const editor = {
getTokenAt() {
getTokenAt () {
return {
string: ' ',
type: null
@@ -97,7 +97,7 @@ describe('hint.js', () => {
// mock showHint and editor
sinon.stub(CM, 'showHint')
const editor = {
getTokenAt() {
getTokenAt () {
return {
string: ';',
type: 'punctuation'
@@ -115,11 +115,11 @@ describe('hint.js', () => {
sinon.restore()
})
it("getHints returns [ ] if there is only one option and the token is already completed with this option", () => {
it('getHints returns [ ] if there is only one option and the token is already completed with this option', () => {
// mock CM.hint.sql and editor
sinon.stub(CM.hint, 'sql').returns({ list: [{ text: 'SELECT' }] })
const editor = {
getTokenAt() {
getTokenAt () {
return {
string: 'select',
type: 'keyword'
@@ -134,15 +134,15 @@ describe('hint.js', () => {
sinon.restore()
})
it("getHints returns hints as is when there are more than one option", () => {
it('getHints returns hints as is when there are more than one option', () => {
// mock CM.hint.sql and editor
let list = [
const list = [
{ text: 'SELECT' },
{ text: 'ST' }
]
sinon.stub(CM.hint, 'sql').returns({ list })
const editor = {
getTokenAt() {
getTokenAt () {
return {
string: 'se',
type: 'keyword'
@@ -157,12 +157,12 @@ describe('hint.js', () => {
sinon.restore()
})
it("getHints returns hints as is when there only one option but the token is not cpmpleted", () => {
it('getHints returns hints as is when there only one option but the token is not cpmpleted', () => {
// mock CM.hint.sql and editor
let list = [{ text: 'SELECT' }]
const list = [{ text: 'SELECT' }]
sinon.stub(CM.hint, 'sql').returns({ list })
const editor = {
getTokenAt() {
getTokenAt () {
return {
string: 'sele',
type: 'keyword'
@@ -184,7 +184,7 @@ describe('hint.js', () => {
// mock showHint and editor
sinon.stub(CM, 'showHint')
const editor = {
getTokenAt() {
getTokenAt () {
return {
string: 'SELECT',
type: 'keyword'
@@ -193,7 +193,7 @@ describe('hint.js', () => {
getCursor: sinon.stub()
}
const clock = sinon.useFakeTimers();
const clock = sinon.useFakeTimers()
hint.show(editor)
clock.tick(500)