1
0
mirror of https://github.com/lana-k/sqliteviz.git synced 2025-12-07 02:28:54 +08:00

add tests in github actions

This commit is contained in:
lana-k
2021-01-13 21:51:04 +01:00
parent 3168c77c17
commit 6612f4444b
10 changed files with 191 additions and 154 deletions

View File

@@ -1,6 +1,6 @@
import { expect } from 'chai'
import { mutations, actions } from '@/store'
const {
const {
saveSchema,
updateTab,
deleteTab,
@@ -15,11 +15,14 @@ describe('mutations', () => {
it('saveSchema', () => {
// mock state
const state = {}
const schema = [
{ name: 'table1', columns: [
{ name: 'id', type: 'INTEGER' }
]}
{
name: 'table1',
columns: [
{ name: 'id', type: 'INTEGER' }
]
}
]
saveSchema(state, {
dbName: 'test',
@@ -323,7 +326,7 @@ describe('mutations', () => {
it('setCurrentTab', () => {
// mock state
const state = {
currentTab: { id: 1}
currentTab: { id: 1 }
}
setCurrentTab(state, { id: 2 })
@@ -372,7 +375,6 @@ describe('mutations', () => {
})
})
describe('actions', () => {
it('addTab (new)', async () => {
// mock state
@@ -429,12 +431,12 @@ describe('actions', () => {
// mock state
const state = {
tabs: [ tab1, tab2 ],
untitledLastIndex: 0,
tabs: [tab1, tab2],
untitledLastIndex: 0
}
await addTab({ state }, tab1)
expect(state.tabs).to.have.lengthOf(2)
expect(state.untitledLastIndex).to.equal(0)
})
})
})