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:
@@ -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)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user