1
0
mirror of https://github.com/lana-k/sqliteviz.git synced 2025-12-06 18:18:53 +08:00

fix column order in result set #74

This commit is contained in:
lana-k
2021-08-10 20:31:12 +02:00
parent 2ed5160f65
commit 9f32323a80
13 changed files with 155 additions and 92 deletions

View File

@@ -1,6 +1,6 @@
{ {
"name": "sqliteviz", "name": "sqliteviz",
"version": "0.15.1", "version": "0.15.2",
"license": "Apache-2.0", "license": "Apache-2.0",
"private": true, "private": true,
"scripts": { "scripts": {

View File

@@ -8,10 +8,15 @@ const hintsByCode = {
export default { export default {
getResult (source) { getResult (source) {
const result = {} const result = {
columns: []
}
const values = {}
if (source.meta.fields) { if (source.meta.fields) {
source.meta.fields.forEach(col => { source.meta.fields.forEach(col => {
result[col.trim()] = source.data.map(row => { let colName = col.trim()
result.columns.push(colName)
values[colName] = source.data.map(row => {
let value = row[col] let value = row[col]
if (value instanceof Date) { if (value instanceof Date) {
value = value.toISOString() value = value.toISOString()
@@ -21,7 +26,9 @@ export default {
}) })
} else { } else {
for (let i = 0; i <= source.data[0].length - 1; i++) { for (let i = 0; i <= source.data[0].length - 1; i++) {
result[`col${i + 1}`] = source.data.map(row => { let colName = `col${i + 1}`
result.columns.push(colName)
values[colName] = source.data.map(row => {
let value = row[i] let value = row[i]
if (value instanceof Date) { if (value instanceof Date) {
value = value.toISOString() value = value.toISOString()
@@ -30,6 +37,8 @@ export default {
}) })
} }
} }
result.values = values
return result return result
}, },

View File

@@ -30,7 +30,7 @@
<tr v-for="rowIndex in currentPageData.count" :key="rowIndex"> <tr v-for="rowIndex in currentPageData.count" :key="rowIndex">
<td v-for="(col, colIndex) in columns" :key="colIndex"> <td v-for="(col, colIndex) in columns" :key="colIndex">
<div class="cell-data" :style="cellStyle"> <div class="cell-data" :style="cellStyle">
{{ dataSet[col][rowIndex - 1 + currentPageData.start] }} {{ dataSet.values[col][rowIndex - 1 + currentPageData.start] }}
</div> </div>
</td> </td>
</tr> </tr>
@@ -74,10 +74,10 @@ export default {
}, },
computed: { computed: {
columns () { columns () {
return Object.keys(this.dataSet) return this.dataSet.columns
}, },
rowCount () { rowCount () {
return this.dataSet[this.columns[0]].length return this.dataSet.values[this.columns[0]].length
}, },
cellStyle () { cellStyle () {
const eq = this.tableWidth / this.columns.length const eq = this.tableWidth / this.columns.length

View File

@@ -48,17 +48,22 @@ export default class Sql {
throw new Error('exec: Missing query string') throw new Error('exec: Missing query string')
} }
const sqlResults = this.db.exec(sql, params) const sqlResults = this.db.exec(sql, params)
return sqlResults.map(result => _getDataSourcesFromSqlResult(result)) return sqlResults.map(result => {
return {
columns: result.columns,
values: _getDataSourcesFromSqlResult(result)
}
})
} }
import (tabName, data, progressCounterId, progressCallback, chunkSize = 1500) { import (tabName, data, progressCounterId, progressCallback, chunkSize = 1500) {
if (this.db === null) { if (this.db === null) {
this.createDb() this.createDb()
} }
const columns = Object.keys(data) const columns = data.columns
const rowCount = data[columns[0]].length const rowCount = data.values[columns[0]].length
this.db.exec(dbUtils.getCreateStatement(tabName, data)) this.db.exec(dbUtils.getCreateStatement(tabName, data.values))
const chunks = dbUtils.generateChunks(data, chunkSize) const chunks = dbUtils.generateChunks(data.values, chunkSize)
const chunksAmount = Math.ceil(rowCount / chunkSize) const chunksAmount = Math.ceil(rowCount / chunkSize)
let count = 0 let count = 0
const insertStr = dbUtils.getInsertStmt(tabName, columns) const insertStr = dbUtils.getInsertStmt(tabName, columns)

View File

@@ -88,11 +88,11 @@ class Database {
const result = await this.execute(getSchemaSql) const result = await this.execute(getSchemaSql)
// Parse DDL statements to get column names and types // Parse DDL statements to get column names and types
const parsedSchema = [] const parsedSchema = []
if (result && result.name) { if (result && result.values && result.values.name) {
result.name.forEach((table, index) => { result.values.name.forEach((table, index) => {
parsedSchema.push({ parsedSchema.push({
name: table, name: table,
columns: stms.getColumns(result.sql[index]) columns: stms.getColumns(result.values.sql[index])
}) })
}) })
} }

View File

@@ -44,13 +44,13 @@ export default {
async created () { async created () {
const state = this.$store.state const state = this.$store.state
let result = await state.db.execute('select sqlite_version()') let result = (await state.db.execute('select sqlite_version()')).values
this.info.push({ this.info.push({
name: 'SQLite version', name: 'SQLite version',
info: result['sqlite_version()'] info: result['sqlite_version()']
}) })
result = await state.db.execute('PRAGMA compile_options') result = (await state.db.execute('PRAGMA compile_options')).values
this.info.push({ this.info.push({
name: 'SQLite compile options', name: 'SQLite compile options',
info: result.compile_options info: result.compile_options

View File

@@ -38,7 +38,7 @@
<teleport :to="`#${layout.dataView}-${tabIndex}`"> <teleport :to="`#${layout.dataView}-${tabIndex}`">
<data-view <data-view
:data-source="result" :data-source="(result && result.values) || null"
:init-options="initViewOptions" :init-options="initViewOptions"
:init-mode="initViewType" :init-mode="initViewType"
ref="dataView" ref="dataView"

View File

@@ -58,8 +58,11 @@ describe('CsvImport.vue', () => {
sinon.stub(csv, 'parse').resolves({ sinon.stub(csv, 'parse').resolves({
delimiter: '|', delimiter: '|',
data: { data: {
col1: [1, 2], columns: ['col2', 'col1' ],
col2: ['foo', 'bar'] values: {
col1: [1, 2],
col2: ['foo', 'bar']
}
}, },
rowCount: 2, rowCount: 2,
messages: [{ messages: [{
@@ -82,10 +85,10 @@ describe('CsvImport.vue', () => {
expect(wrapper.findComponent({ name: 'check-box' }).vm.checked).to.equal(true) expect(wrapper.findComponent({ name: 'check-box' }).vm.checked).to.equal(true)
const rows = wrapper.findAll('tbody tr') const rows = wrapper.findAll('tbody tr')
expect(rows).to.have.lengthOf(2) expect(rows).to.have.lengthOf(2)
expect(rows.at(0).findAll('td').at(0).text()).to.equal('1') expect(rows.at(0).findAll('td').at(0).text()).to.equal('foo')
expect(rows.at(0).findAll('td').at(1).text()).to.equal('foo') expect(rows.at(0).findAll('td').at(1).text()).to.equal('1')
expect(rows.at(1).findAll('td').at(0).text()).to.equal('2') expect(rows.at(1).findAll('td').at(0).text()).to.equal('bar')
expect(rows.at(1).findAll('td').at(1).text()).to.equal('bar') expect(rows.at(1).findAll('td').at(1).text()).to.equal('2')
expect(wrapper.findComponent({ name: 'logs' }).text()) expect(wrapper.findComponent({ name: 'logs' }).text())
.to.include('Information about row 0. Comma was used as a standart delimiter.') .to.include('Information about row 0. Comma was used as a standart delimiter.')
expect(wrapper.findComponent({ name: 'logs' }).text()) expect(wrapper.findComponent({ name: 'logs' }).text())
@@ -99,8 +102,11 @@ describe('CsvImport.vue', () => {
parse.onCall(0).resolves({ parse.onCall(0).resolves({
delimiter: '|', delimiter: '|',
data: { data: {
col1: [1], columns: ['col2', 'col1'],
col2: ['foo'] values: {
col1: [1],
col2: ['foo']
}
}, },
rowCount: 1 rowCount: 1
}) })
@@ -113,8 +119,11 @@ describe('CsvImport.vue', () => {
parse.onCall(1).resolves({ parse.onCall(1).resolves({
delimiter: ',', delimiter: ',',
data: { data: {
col1: [2], columns: ['col2', 'col1'],
col2: ['bar'] values: {
col1: [2],
col2: ['bar']
}
}, },
rowCount: 1, rowCount: 1,
hasErrors: false hasErrors: false
@@ -125,16 +134,19 @@ describe('CsvImport.vue', () => {
let rows = wrapper.findAll('tbody tr') let rows = wrapper.findAll('tbody tr')
expect(rows).to.have.lengthOf(1) expect(rows).to.have.lengthOf(1)
expect(rows.at(0).findAll('td').at(0).text()).to.equal('2') expect(rows.at(0).findAll('td').at(0).text()).to.equal('bar')
expect(rows.at(0).findAll('td').at(1).text()).to.equal('bar') expect(rows.at(0).findAll('td').at(1).text()).to.equal('2')
expect(wrapper.findComponent({ name: 'logs' }).text()) expect(wrapper.findComponent({ name: 'logs' }).text())
.to.include('Preview parsing is completed in') .to.include('Preview parsing is completed in')
parse.onCall(2).resolves({ parse.onCall(2).resolves({
delimiter: ',', delimiter: ',',
data: { data: {
col1: [3], columns: ['col2', 'col1'],
col2: ['baz'] values: {
col1: [3],
col2: ['baz']
}
}, },
rowCount: 1, rowCount: 1,
hasErrors: true, hasErrors: true,
@@ -152,8 +164,8 @@ describe('CsvImport.vue', () => {
await csv.parse.returnValues[2] await csv.parse.returnValues[2]
rows = wrapper.findAll('tbody tr') rows = wrapper.findAll('tbody tr')
expect(rows).to.have.lengthOf(1) expect(rows).to.have.lengthOf(1)
expect(rows.at(0).findAll('td').at(0).text()).to.equal('3') expect(rows.at(0).findAll('td').at(0).text()).to.equal('baz')
expect(rows.at(0).findAll('td').at(1).text()).to.equal('baz') expect(rows.at(0).findAll('td').at(1).text()).to.equal('3')
expect(wrapper.findComponent({ name: 'logs' }).text()) expect(wrapper.findComponent({ name: 'logs' }).text())
.to.contain('Error in row 0. Quote is missed. Edit your CSV so that the field has a closing quote char.') .to.contain('Error in row 0. Quote is missed. Edit your CSV so that the field has a closing quote char.')
expect(wrapper.findComponent({ name: 'logs' }).text()) expect(wrapper.findComponent({ name: 'logs' }).text())
@@ -162,8 +174,11 @@ describe('CsvImport.vue', () => {
parse.onCall(3).resolves({ parse.onCall(3).resolves({
delimiter: ',', delimiter: ',',
data: { data: {
col1: [4], columns: ['col2', 'col1'],
col2: ['qux'] values: {
col1: [4],
col2: ['qux']
}
}, },
rowCount: 1, rowCount: 1,
hasErrors: false hasErrors: false
@@ -173,16 +188,19 @@ describe('CsvImport.vue', () => {
await csv.parse.returnValues[3] await csv.parse.returnValues[3]
rows = wrapper.findAll('tbody tr') rows = wrapper.findAll('tbody tr')
expect(rows).to.have.lengthOf(1) expect(rows).to.have.lengthOf(1)
expect(rows.at(0).findAll('td').at(0).text()).to.equal('4') expect(rows.at(0).findAll('td').at(0).text()).to.equal('qux')
expect(rows.at(0).findAll('td').at(1).text()).to.equal('qux') expect(rows.at(0).findAll('td').at(1).text()).to.equal('4')
expect(wrapper.findComponent({ name: 'logs' }).text()) expect(wrapper.findComponent({ name: 'logs' }).text())
.to.contain('Preview parsing is completed in') .to.contain('Preview parsing is completed in')
parse.onCall(4).resolves({ parse.onCall(4).resolves({
delimiter: ',', delimiter: ',',
data: { data: {
col1: [5], columns: ['col2', 'col1'],
col2: ['corge'] values: {
col1: [5],
col2: ['corge']
}
}, },
rowCount: 1, rowCount: 1,
hasErrors: false hasErrors: false
@@ -192,8 +210,9 @@ describe('CsvImport.vue', () => {
await csv.parse.returnValues[4] await csv.parse.returnValues[4]
rows = wrapper.findAll('tbody tr') rows = wrapper.findAll('tbody tr')
expect(rows).to.have.lengthOf(1) expect(rows).to.have.lengthOf(1)
expect(rows.at(0).findAll('td').at(0).text()).to.equal('5') expect(rows.at(0).findAll('td').at(0).text()).to.equal('corge')
expect(rows.at(0).findAll('td').at(1).text()).to.equal('corge') expect(rows.at(0).findAll('td').at(1).text()).to.equal('5')
expect(wrapper.findComponent({ name: 'logs' }).text()) expect(wrapper.findComponent({ name: 'logs' }).text())
.to.include('Preview parsing is completed in') .to.include('Preview parsing is completed in')
}) })

View File

@@ -19,9 +19,12 @@ describe('csv.js', () => {
} }
} }
expect(csv.getResult(source)).to.eql({ expect(csv.getResult(source)).to.eql({
id: [1, 2], columns: ['id', 'name', 'date'],
name: ['foo', 'bar'], values: {
date: ['2021-06-30T14:10:24.717Z', '2021-07-30T14:10:15.717Z'] id: [1, 2],
name: ['foo', 'bar'],
date: ['2021-06-30T14:10:24.717Z', '2021-07-30T14:10:15.717Z']
}
}) })
}) })
@@ -34,9 +37,12 @@ describe('csv.js', () => {
meta: {} meta: {}
} }
expect(csv.getResult(source)).to.eql({ expect(csv.getResult(source)).to.eql({
col1: [1, 2], columns: ['col1', 'col2', 'col3'],
col2: ['foo', 'bar'], values: {
col3: ['2021-06-30T14:10:24.717Z', '2021-07-30T14:10:15.717Z'] col1: [1, 2],
col2: ['foo', 'bar'],
col3: ['2021-06-30T14:10:24.717Z', '2021-07-30T14:10:15.717Z']
}
}) })
}) })
@@ -73,8 +79,11 @@ describe('csv.js', () => {
const result = await csv.parse(file) const result = await csv.parse(file)
expect(result).to.eql({ expect(result).to.eql({
data: { data: {
col1: [1, 2], columns: ['col1', 'col2'],
col2: ['foo', 'bar'] values: {
col1: [1, 2],
col2: ['foo', 'bar']
}
}, },
delimiter: ',', delimiter: ',',
rowCount: 2, rowCount: 2,

View File

@@ -35,9 +35,12 @@ describe('_sql.js', () => {
const result = sql.exec('SELECT * from test') const result = sql.exec('SELECT * from test')
expect(result).to.have.lengthOf(1) expect(result).to.have.lengthOf(1)
expect(result[0]).to.eql({ expect(result[0]).to.eql({
id: [1, 2], columns: ['id', 'name','faculty'],
name: ['Harry Potter', 'Draco Malfoy'], values: {
faculty: ['Griffindor', 'Slytherin'] id: [1, 2],
name: ['Harry Potter', 'Draco Malfoy'],
faculty: ['Griffindor', 'Slytherin']
}
}) })
}) })
@@ -64,13 +67,16 @@ describe('_sql.js', () => {
it('imports', async () => { it('imports', async () => {
const data = { const data = {
id: [1, 2, 3, 4], columns: ['id', 'name'],
name: [ values: {
'Harry Potter', id: [1, 2, 3, 4],
'Draco Malfoy', name: [
'Hermione Granger', 'Harry Potter',
'Ron Weasley' 'Draco Malfoy',
] 'Hermione Granger',
'Ron Weasley'
]
}
} }
const progressCallback = sinon.stub() const progressCallback = sinon.stub()
const progressCounterId = 1 const progressCounterId = 1
@@ -104,7 +110,7 @@ describe('_sql.js', () => {
anotherSql.open(data) anotherSql.open(data)
const result = anotherSql.exec('SELECT * from test') const result = anotherSql.exec('SELECT * from test')
expect(result).to.have.lengthOf(1) expect(result).to.have.lengthOf(1)
expect(result[0]).to.eql({ expect(result[0].values).to.eql({
id: [1, 2], id: [1, 2],
name: ['Harry Potter', 'Draco Malfoy'], name: ['Harry Potter', 'Draco Malfoy'],
faculty: ['Griffindor', 'Slytherin'] faculty: ['Griffindor', 'Slytherin']
@@ -146,26 +152,29 @@ describe('_sql.js', () => {
`) `)
let result = sql.exec('SELECT * from test') let result = sql.exec('SELECT * from test')
expect(result[0]).to.eql({ expect(result[0].values).to.eql({
id: [1, 2], id: [1, 2],
name: ['foo', 'bar'] name: ['foo', 'bar']
}) })
const data = { const data = {
id: [1, 2, 3, 4], columns: ['id', 'name'],
name: [ values: {
'Harry Potter', id: [1, 2, 3, 4],
'Draco Malfoy', name: [
'Hermione Granger', 'Harry Potter',
'Ron Weasley' 'Draco Malfoy',
] 'Hermione Granger',
'Ron Weasley'
]
}
} }
// import adds table // import adds table
sql.import('foo', data, 1, sinon.stub(), 2) sql.import('foo', data, 1, sinon.stub(), 2)
result = sql.exec('SELECT * from foo') result = sql.exec('SELECT * from foo')
expect(result[0]).to.eql(data) expect(result[0]).to.eql(data)
result = sql.exec('SELECT * from test') result = sql.exec('SELECT * from test')
expect(result[0]).to.eql({ expect(result[0].values).to.eql({
id: [1, 2], id: [1, 2],
name: ['foo', 'bar'] name: ['foo', 'bar']
}) })

View File

@@ -85,7 +85,7 @@ describe('database.js', () => {
await db.loadDb(buffer) await db.loadDb(buffer)
const result = await db.execute('SELECT * from test limit 1; SELECT * from test;') const result = await db.execute('SELECT * from test limit 1; SELECT * from test;')
expect(result).to.eql({ expect(result.values).to.eql({
id: [1, 2], id: [1, 2],
name: ['Harry Potter', 'Draco Malfoy'], name: ['Harry Potter', 'Draco Malfoy'],
faculty: ['Griffindor', 'Slytherin'] faculty: ['Griffindor', 'Slytherin']
@@ -116,9 +116,12 @@ describe('database.js', () => {
it('adds table from csv', async () => { it('adds table from csv', async () => {
const data = { const data = {
id: [1, 2], columns: ['id', 'name','faculty'],
name: ['Harry Potter', 'Draco Malfoy'], values: {
faculty: ['Griffindor', 'Slytherin'] id: [1, 2],
name: ['Harry Potter', 'Draco Malfoy'],
faculty: ['Griffindor', 'Slytherin']
}
} }
const progressHandler = sinon.spy() const progressHandler = sinon.spy()
const progressCounterId = db.createProgressCounter(progressHandler) const progressCounterId = db.createProgressCounter(progressHandler)
@@ -144,9 +147,12 @@ describe('database.js', () => {
it('addTableFromCsv throws errors', async () => { it('addTableFromCsv throws errors', async () => {
const data = { const data = {
id: [1, 2], columns: [],
name: ['Harry Potter', 'Draco Malfoy'], values: {
faculty: null id: [1, 2],
name: ['Harry Potter', 'Draco Malfoy'],
faculty: null
}
} }
const progressHandler = sinon.stub() const progressHandler = sinon.stub()
const progressCounterId = db.createProgressCounter(progressHandler) const progressCounterId = db.createProgressCounter(progressHandler)
@@ -214,8 +220,11 @@ describe('database.js', () => {
// check that new db works and has the same table and data // check that new db works and has the same table and data
result = await anotherDb.execute('SELECT * from foo') result = await anotherDb.execute('SELECT * from foo')
expect(result).to.eql({ expect(result).to.eql({
id: [1], columns: ['id', 'name'],
name: ['Harry Potter'] values: {
id: [1],
name: ['Harry Potter']
}
}) })
}) })

View File

@@ -37,7 +37,7 @@ describe('SQLite extensions', function () {
abs(pi() / 2 - atan2(1, 0)) < 0.000001 abs(pi() / 2 - atan2(1, 0)) < 0.000001
`) `)
expect(actual).to.eql({ expect(actual.values).to.eql({
'abs(3.1415926 - pi()) < 0.000001': [1], 'abs(3.1415926 - pi()) < 0.000001': [1],
'abs(1 - cos(2 * pi())) < 0.000001': [1], 'abs(1 - cos(2 * pi())) < 0.000001': [1],
'abs(0 - sin(pi())) < 0.000001': [1], 'abs(0 - sin(pi())) < 0.000001': [1],
@@ -71,7 +71,7 @@ describe('SQLite extensions', function () {
ceil(-1.95) + ceil(1.95), ceil(-1.95) + ceil(1.95),
floor(-1.95) + floor(1.95) floor(-1.95) + floor(1.95)
`) `)
expect(actual).to.eql({ expect(actual.values).to.eql({
'exp(0)': [1], 'exp(0)': [1],
'log(exp(1))': [1], 'log(exp(1))': [1],
'log10(10000)': [4], 'log10(10000)': [4],
@@ -99,7 +99,7 @@ describe('SQLite extensions', function () {
padc('foo', 5), padc('foo', 5),
strfilter('abcba', 'bc') strfilter('abcba', 'bc')
`) `)
expect(actual).to.eql({ expect(actual.values).to.eql({
"replicate('ab', 4)": ['abababab'], "replicate('ab', 4)": ['abababab'],
"charindex('ab', 'foobarabbarfoo')": [7], "charindex('ab', 'foobarabbarfoo')": [7],
"charindex('ab', 'foobarabbarfoo', 8)": [0], "charindex('ab', 'foobarabbarfoo', 8)": [0],
@@ -137,7 +137,7 @@ describe('SQLite extensions', function () {
VALUES (1) VALUES (1)
) )
`) `)
expect(actual).to.eql({ expect(actual.values).to.eql({
'abs( 3.77406806 - stdev(x)) < 0.000001': [1], 'abs( 3.77406806 - stdev(x)) < 0.000001': [1],
'abs(14.24358974 - variance(x)) < 0.000001': [1], 'abs(14.24358974 - variance(x)) < 0.000001': [1],
'mode(x)': [1], 'mode(x)': [1],
@@ -152,7 +152,7 @@ describe('SQLite extensions', function () {
SELECT value SELECT value
FROM generate_series(5, 20, 5) FROM generate_series(5, 20, 5)
`) `)
expect(actual).to.eql({ expect(actual.values).to.eql({
value: [5, 10, 15, 20] value: [5, 10, 15, 20]
}) })
}) })
@@ -194,7 +194,7 @@ describe('SQLite extensions', function () {
WHERE nc.root = 2 AND nc.depth = 2 WHERE nc.root = 2 AND nc.depth = 2
); );
`) `)
expect(actual).to.eql({ expect(actual.values).to.eql({
name: [ name: [
'_sql.spec.js', '_sql.spec.js',
'_statements.spec.js', '_statements.spec.js',
@@ -212,7 +212,7 @@ describe('SQLite extensions', function () {
length(uuid()) as length, length(uuid()) as length,
uuid_str(uuid_blob('26a8349c8a7f4cbeb519bf792c3d7ac6')) as uid uuid_str(uuid_blob('26a8349c8a7f4cbeb519bf792c3d7ac6')) as uid
`) `)
expect(actual).to.eql({ expect(actual.values).to.eql({
length: [36], length: [36],
uid: ['26a8349c-8a7f-4cbe-b519-bf792c3d7ac6'] uid: ['26a8349c-8a7f-4cbe-b519-bf792c3d7ac6']
}) })
@@ -225,7 +225,7 @@ describe('SQLite extensions', function () {
regexpi('=\\s?\\d+', 'const foo = 123; const bar = "bar"') as two, regexpi('=\\s?\\d+', 'const foo = 123; const bar = "bar"') as two,
'const foo = 123; const bar = "bar"' REGEXP '=\\s?\\d+' as three 'const foo = 123; const bar = "bar"' REGEXP '=\\s?\\d+' as three
`) `)
expect(actual).to.eql({ expect(actual.values).to.eql({
one: [1], one: [1],
two: [1], two: [1],
three: [1] three: [1]
@@ -260,7 +260,7 @@ describe('SQLite extensions', function () {
ALTER TABLE surface DROP COLUMN rownum; ALTER TABLE surface DROP COLUMN rownum;
SELECT * FROM surface; SELECT * FROM surface;
`) `)
expect(actual).to.eql({ expect(actual.values).to.eql({
x: [5, 10, 15], x: [5, 10, 15],
y: [3, 6, 9], y: [3, 6, 9],
'5.0': [3.2, 4.3, 5.4], '5.0': [3.2, 4.3, 5.4],
@@ -292,7 +292,7 @@ describe('SQLite extensions', function () {
WHERE body MATCH '"full-text" NOT document' WHERE body MATCH '"full-text" NOT document'
ORDER BY rank; ORDER BY rank;
`) `)
expect(actual).to.eql({ expect(actual.values).to.eql({
sender: ['bar@localhost'] sender: ['bar@localhost']
}) })
}) })

View File

@@ -129,8 +129,11 @@ describe('Schema.vue', () => {
sinon.stub(csv, 'parse').resolves({ sinon.stub(csv, 'parse').resolves({
delimiter: '|', delimiter: '|',
data: { data: {
col1: [1], columns: ['col1', 'col2'],
col2: ['foo'] values: {
col1: [1],
col2: ['foo']
}
}, },
hasErrors: false, hasErrors: false,
messages: [] messages: []
@@ -168,7 +171,7 @@ describe('Schema.vue', () => {
]) ])
const res = await wrapper.vm.$store.state.db.execute('select * from test') const res = await wrapper.vm.$store.state.db.execute('select * from test')
expect(res).to.eql({ expect(res.values).to.eql({
col1: [1], col1: [1],
col2: ['foo'] col2: ['foo']
}) })