mirror of
https://github.com/lana-k/sqliteviz.git
synced 2025-12-07 02:28:54 +08:00
#116 update tests
This commit is contained in:
@@ -106,10 +106,65 @@ describe('fileIo.js', () => {
|
||||
await expect(fIo.readAsArrayBuffer(blob)).to.be.rejectedWith('Problem parsing input file.')
|
||||
})
|
||||
|
||||
it('isJSON', () => {
|
||||
let file = { type: 'application/json' }
|
||||
expect(fIo.isJSON(file)).to.equal(true)
|
||||
|
||||
file = { type: 'application/x-sqlite3' }
|
||||
expect(fIo.isJSON(file)).to.equal(false)
|
||||
|
||||
file = { type: '', name: 'test.db' }
|
||||
expect(fIo.isJSON(file)).to.equal(false)
|
||||
|
||||
file = { type: '', name: 'test.sqlite' }
|
||||
expect(fIo.isJSON(file)).to.equal(false)
|
||||
|
||||
file = { type: '', name: 'test.sqlite3' }
|
||||
expect(fIo.isJSON(file)).to.equal(false)
|
||||
|
||||
file = { type: '', name: 'test.csv' }
|
||||
expect(fIo.isJSON(file)).to.equal(false)
|
||||
|
||||
file = { type: '', name: 'test.ndjson' }
|
||||
expect(fIo.isJSON(file)).to.equal(false)
|
||||
|
||||
file = { type: 'text', name: 'test.db' }
|
||||
expect(fIo.isJSON(file)).to.equal(false)
|
||||
})
|
||||
|
||||
it('isNDJSON', () => {
|
||||
let file = { type: 'application/json', name: 'test.json' }
|
||||
expect(fIo.isNDJSON(file)).to.equal(false)
|
||||
|
||||
file = { type: 'application/x-sqlite3', name: 'test.sqlite3' }
|
||||
expect(fIo.isNDJSON(file)).to.equal(false)
|
||||
|
||||
file = { type: '', name: 'test.db' }
|
||||
expect(fIo.isNDJSON(file)).to.equal(false)
|
||||
|
||||
file = { type: '', name: 'test.sqlite' }
|
||||
expect(fIo.isNDJSON(file)).to.equal(false)
|
||||
|
||||
file = { type: '', name: 'test.sqlite3' }
|
||||
expect(fIo.isNDJSON(file)).to.equal(false)
|
||||
|
||||
file = { type: '', name: 'test.csv' }
|
||||
expect(fIo.isNDJSON(file)).to.equal(false)
|
||||
|
||||
file = { type: '', name: 'test.ndjson' }
|
||||
expect(fIo.isNDJSON(file)).to.equal(true)
|
||||
|
||||
file = { type: 'text', name: 'test.db' }
|
||||
expect(fIo.isNDJSON(file)).to.equal(false)
|
||||
})
|
||||
|
||||
it('isDatabase', () => {
|
||||
let file = { type: 'application/vnd.sqlite3' }
|
||||
expect(fIo.isDatabase(file)).to.equal(true)
|
||||
|
||||
file = { type: 'application/json' }
|
||||
expect(fIo.isDatabase(file)).to.equal(false)
|
||||
|
||||
file = { type: 'application/x-sqlite3' }
|
||||
expect(fIo.isDatabase(file)).to.equal(true)
|
||||
|
||||
@@ -125,6 +180,9 @@ describe('fileIo.js', () => {
|
||||
file = { type: '', name: 'test.csv' }
|
||||
expect(fIo.isDatabase(file)).to.equal(false)
|
||||
|
||||
file = { type: '', name: 'test.ndjson' }
|
||||
expect(fIo.isDatabase(file)).to.equal(false)
|
||||
|
||||
file = { type: 'text', name: 'test.db' }
|
||||
expect(fIo.isDatabase(file)).to.equal(false)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user