1
0
mirror of https://github.com/lana-k/sqliteviz.git synced 2025-12-08 02:58:54 +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

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