Skip to content

Commit 108d96a

Browse files
committed
#121 fix lint
1 parent f55a8ca commit 108d96a

File tree

9 files changed

+63
-62
lines changed

9 files changed

+63
-62
lines changed

src/App.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export default {
2222
handler () {
2323
storedInquiries.updateStorage(this.inquiries)
2424
}
25-
}
25+
}
2626
}
2727
}
2828
</script>

src/store/actions.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -52,19 +52,19 @@ export default {
5252
inquiry => !inquiryIdSet.has(inquiry.id)
5353
)
5454

55-
// Close deleted inquiries if it was opened
56-
const tabs = state.tabs
57-
let i = tabs.length - 1
58-
while (i > -1) {
59-
if (inquiryIdSet.has(tabs[i].id)) {
60-
commit('deleteTab', tabs[i])
61-
}
62-
i--
63-
}
55+
// Close deleted inquiries if it was opened
56+
const tabs = state.tabs
57+
let i = tabs.length - 1
58+
while (i > -1) {
59+
if (inquiryIdSet.has(tabs[i].id)) {
60+
commit('deleteTab', tabs[i])
61+
}
62+
i--
63+
}
6464
},
65-
renameInquiry ({ state, commit }, {inquiryId, newName}) {
65+
renameInquiry ({ state, commit }, { inquiryId, newName }) {
6666
const renamingInquiry = state.inquiries
67-
.find(inquiry => inquiry.id === inquiryId)
67+
.find(inquiry => inquiry.id === inquiryId)
6868

6969
renamingInquiry.name = newName
7070

src/views/Main/Inquiries/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ export default {
332332
return
333333
}
334334
this.$store.dispatch('renameInquiry', {
335-
inquiryId: this.processedInquiryId,
335+
inquiryId: this.processedInquiryId,
336336
newName: this.newName
337337
})
338338

src/views/Main/MainMenu.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@ export default {
133133
134134
// Save inquiry
135135
const value = await this.$store.dispatch('saveInquiry', {
136-
inquiryTab:this.currentInquiry,
137-
newName:this.name
136+
inquiryTab: this.currentInquiry,
137+
newName: this.name
138138
})
139139
140140
// Update tab in store

tests/App.spec.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ describe('App.vue', () => {
1313

1414
it('Gets inquiries', () => {
1515
sinon.stub(storedInquiries, 'getStoredInquiries').returns([
16-
{id: 1}, {id: 2}, {id: 3}
16+
{ id: 1 }, { id: 2 }, { id: 3 }
1717
])
1818
const state = {
1919
predefinedInquiries: [],
@@ -22,30 +22,31 @@ describe('App.vue', () => {
2222
const store = new Vuex.Store({ state, mutations })
2323
shallowMount(App, { store, stubs: ['router-view'] })
2424

25-
expect(state.inquiries).to.eql([{id: 1}, {id: 2}, {id: 3}])
25+
expect(state.inquiries).to.eql([{ id: 1 }, { id: 2 }, { id: 3 }])
2626
})
2727

2828
it('Updates inquiries when they change in store', async () => {
2929
sinon.stub(storedInquiries, 'getStoredInquiries').returns([
30-
{id: 1, name: 'foo'}, {id: 2, name: 'baz'}, {id: 3, name: 'bar'}
30+
{ id: 1, name: 'foo' }, { id: 2, name: 'baz' }, { id: 3, name: 'bar' }
3131
])
3232
sinon.spy(storedInquiries, 'updateStorage')
3333

34-
3534
const state = {
3635
predefinedInquiries: [],
3736
inquiries: []
3837
}
3938
const store = new Vuex.Store({ state, mutations })
4039
const wrapper = shallowMount(App, { store, stubs: ['router-view'] })
4140

42-
store.state.inquiries.splice(0, 1, {id: 1, name: 'new foo name'})
41+
store.state.inquiries.splice(0, 1, { id: 1, name: 'new foo name' })
4342
await wrapper.vm.$nextTick()
4443

4544
expect(storedInquiries.updateStorage.calledTwice).to.equal(true)
4645

4746
expect(storedInquiries.updateStorage.args[1][0]).to.eql([
48-
{id: 1, name: 'new foo name'}, {id: 2, name: 'baz'}, {id: 3, name: 'bar'}
47+
{ id: 1, name: 'new foo name' },
48+
{ id: 2, name: 'baz' },
49+
{ id: 3, name: 'bar' }
4950
])
5051
})
5152
})

tests/store/actions.spec.js

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { expect } from 'chai'
22
import actions from '@/store/actions'
3+
import sinon from 'sinon'
34

4-
const {
5-
addTab,
5+
const {
6+
addTab,
67
addInquiry,
78
deleteInquiries,
89
renameInquiry,
@@ -90,11 +91,11 @@ describe('actions', () => {
9091

9192
it('addInquiry', async () => {
9293
const state = {
93-
inquiries: [1,2,3]
94+
inquiries: [1, 2, 3]
9495
}
9596

9697
await addInquiry({ state }, 4)
97-
expect(state.inquiries).to.eql([1,2,3,4])
98+
expect(state.inquiries).to.eql([1, 2, 3, 4])
9899
})
99100

100101
it('deleteInquiries', async () => {
@@ -112,19 +113,19 @@ describe('actions', () => {
112113
it('renameInquiry', async () => {
113114
const state = {
114115
inquiries: [
115-
{ id: 1, name: 'foo'},
116-
{ id: 2, name: 'bar' },
117-
{ id: 3, name: 'baz' },
116+
{ id: 1, name: 'foo' },
117+
{ id: 2, name: 'bar' },
118+
{ id: 3, name: 'baz' }
118119
],
119-
tabs: [{ id: 1, name: 'foo'}, { id: 2, name: 'bar' }]
120+
tabs: [{ id: 1, name: 'foo' }, { id: 2, name: 'bar' }]
120121
}
121122
const commit = sinon.spy()
122123

123-
await renameInquiry({ state, commit }, {inquiryId: 2, newName: 'new name'})
124+
await renameInquiry({ state, commit }, { inquiryId: 2, newName: 'new name' })
124125
expect(state.inquiries).to.eql([
125-
{ id: 1, name: 'foo'},
126-
{ id: 2, name: 'new name' },
127-
{ id: 3, name: 'baz' },
126+
{ id: 1, name: 'foo' },
127+
{ id: 2, name: 'new name' },
128+
{ id: 3, name: 'baz' }
128129
])
129130
expect(commit.calledWith('updateTab', {
130131
tab: { id: 2, name: 'bar' },
@@ -137,7 +138,7 @@ describe('actions', () => {
137138
it('saveInquiry adds new inquiry in the storage', async () => {
138139
const now = new Date()
139140
const nowPlusMinute = new Date(now.getTime() + 60 * 1000)
140-
141+
141142
const tab = {
142143
id: 1,
143144
query: 'select * from foo',
@@ -152,12 +153,12 @@ describe('actions', () => {
152153
}
153154
const state = {
154155
inquiries: [],
155-
tabs: [tab],
156+
tabs: [tab]
156157
}
157158

158-
const value = await saveInquiry({ state }, {
159-
inquiryTab: tab,
160-
newName: 'foo'
159+
const value = await saveInquiry({ state }, {
160+
inquiryTab: tab,
161+
newName: 'foo'
161162
})
162163
expect(value.id).to.equal(tab.id)
163164
expect(value.name).to.equal('foo')
@@ -183,12 +184,12 @@ describe('actions', () => {
183184

184185
const state = {
185186
inquiries: [],
186-
tabs: [tab],
187+
tabs: [tab]
187188
}
188189

189-
const first = await saveInquiry({ state }, {
190-
inquiryTab: tab,
191-
newName: 'foo'
190+
const first = await saveInquiry({ state }, {
191+
inquiryTab: tab,
192+
newName: 'foo'
192193
})
193194

194195
tab.name = 'foo'
@@ -223,12 +224,12 @@ describe('actions', () => {
223224

224225
const state = {
225226
inquiries: [],
226-
tabs: [tab],
227+
tabs: [tab]
227228
}
228229

229-
await saveInquiry({ state }, {
230-
inquiryTab: tab,
231-
newName: 'foo'
230+
await saveInquiry({ state }, {
231+
inquiryTab: tab,
232+
newName: 'foo'
232233
})
233234

234235
const inquiries = state.inquiries

tests/store/mutations.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ describe('mutations', () => {
367367
inquiries: []
368368
}
369369

370-
setInquiries(state, [1,2,3])
371-
expect(state.inquiries).to.eql([1,2,3])
370+
setInquiries(state, [1, 2, 3])
371+
expect(state.inquiries).to.eql([1, 2, 3])
372372
})
373373
})

tests/views/Main/Inquiries/Inquiries.spec.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ describe('Inquiries.vue', () => {
9595
createdAt: '2020-03-08T19:57:56.299Z'
9696
}
9797
])
98-
98+
9999
const state = {
100100
predefinedInquiries: [],
101101
inquiries: [
@@ -140,7 +140,7 @@ describe('Inquiries.vue', () => {
140140
createdAt: '2020-03-08T19:57:56.299Z'
141141
}
142142
])
143-
143+
144144
const state = {
145145
predefinedInquiries: [],
146146
inquiries: [
@@ -184,7 +184,7 @@ describe('Inquiries.vue', () => {
184184
createdAt: '2020-03-08T19:57:56.299Z'
185185
}
186186
])
187-
187+
188188
const state = {
189189
predefinedInquiries: [],
190190
inquiries: [
@@ -775,7 +775,7 @@ describe('Inquiries.vue', () => {
775775

776776
const state = {
777777
predefinedInquiries: [],
778-
inquiries: [inquiryInStore]
778+
inquiries: [inquiryInStore]
779779
}
780780
const store = new Vuex.Store({ state, mutations, actions })
781781

tests/views/Main/MainMenu.spec.js

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,6 @@ describe('MainMenu.vue', () => {
361361
const store = new Vuex.Store({ state, mutations, actions })
362362
const $route = { path: '/workspace' }
363363
sinon.stub(storedInquiries, 'isTabNeedName').returns(false)
364-
365364

366365
wrapper = mount(MainMenu, {
367366
store,
@@ -376,8 +375,8 @@ describe('MainMenu.vue', () => {
376375

377376
// check that the inquiry was saved via saveInquiry (newName='')
378377
expect(actions.saveInquiry.calledOnce).to.equal(true)
379-
expect(actions.saveInquiry.args[0][1]).to.eql({
380-
inquiryTab:state.currentTab, newName: ''
378+
expect(actions.saveInquiry.args[0][1]).to.eql({
379+
inquiryTab: state.currentTab, newName: ''
381380
})
382381

383382
// check that the tab was updated
@@ -499,16 +498,16 @@ describe('MainMenu.vue', () => {
499498
.find(button => button.text() === 'Save')
500499
.trigger('click')
501500

502-
await wrapper.vm.$nextTick()
501+
await wrapper.vm.$nextTick()
503502

504503
// check that the dialog is closed
505504
expect(wrapper.find('[data-modal="save"]').exists()).to.equal(false)
506505

507506
// check that the inquiry was saved via saveInquiry (newName='foo')
508507
expect(actions.saveInquiry.calledOnce).to.equal(true)
509508
expect(actions.saveInquiry.args[0][1]).to.eql({
510-
inquiryTab:state.currentTab,
511-
newName:'foo'
509+
inquiryTab: state.currentTab,
510+
newName: 'foo'
512511
})
513512

514513
// check that the tab was updated
@@ -590,16 +589,16 @@ describe('MainMenu.vue', () => {
590589
.find(button => button.text() === 'Save')
591590
.trigger('click')
592591

593-
await wrapper.vm.$nextTick()
592+
await wrapper.vm.$nextTick()
594593

595594
// check that the dialog is closed
596595
expect(wrapper.find('[data-modal="save"]').exists()).to.equal(false)
597596

598597
// check that the inquiry was saved via saveInquiry (newName='bar')
599598
expect(actions.saveInquiry.calledOnce).to.equal(true)
600-
expect(actions.saveInquiry.args[0][1]).to.eql({
601-
inquiryTab:state.currentTab,
602-
newName: 'bar'
599+
expect(actions.saveInquiry.args[0][1]).to.eql({
600+
inquiryTab: state.currentTab,
601+
newName: 'bar'
603602
})
604603

605604
// check that the tab was updated

0 commit comments

Comments
 (0)