lint also tests folder

This commit is contained in:
Alexey Kasyanchuk
2018-06-30 02:03:43 +03:00
parent 8dc7cfecf9
commit c086cd2087
7 changed files with 126 additions and 126 deletions

View File

@ -4,58 +4,58 @@ const mysql = require('mysql')
const config = require('../src/background/config')
describe("sphinx", () => {
let sphinx;
let sphinx;
it("init", function() {
sphinx = mysql.createPool({
connectionLimit: config.sphinx.connectionLimit,
host : config.sphinx.host,
port : config.sphinx.port
});
expect(sphinx)
})
it("init", function() {
sphinx = mysql.createPool({
connectionLimit: config.sphinx.connectionLimit,
host : config.sphinx.host,
port : config.sphinx.port
});
expect(sphinx)
})
it("insert", function(done) {
sphinx.query("INSERT INTO files(id, hash, path, pathIndex, size) VALUES(1, 'a', 'bashaa', 'bashaa', 50)", (err) => {
if(err)
throw new Error(err)
it("insert", function(done) {
sphinx.query("INSERT INTO files(id, hash, path, pathIndex, size) VALUES(1, 'a', 'bashaa', 'bashaa', 50)", (err) => {
if(err)
throw new Error(err)
sphinx.query("INSERT INTO files(id, hash, path, pathIndex, size) VALUES(2, 'b', 'biotu', 'biotu', 30)", (err) => {
if(err)
throw new Error(err)
sphinx.query("INSERT INTO files(id, hash, path, pathIndex, size) VALUES(2, 'b', 'biotu', 'biotu', 30)", (err) => {
if(err)
throw new Error(err)
done()
})
})
})
done()
})
})
})
it("select", function(done) {
sphinx.query("select * from files where hash = 'a'", (err, result) => {
if(!result)
throw new Error(err)
if(result.length !== 1)
throw new Error('not one result')
it("select", function(done) {
sphinx.query("select * from files where hash = 'a'", (err, result) => {
if(!result)
throw new Error(err)
if(result.length !== 1)
throw new Error('not one result')
if(result[0].size !== 50)
throw new Error('not 50 in field')
if(result[0].size !== 50)
throw new Error('not 50 in field')
done()
})
})
done()
})
})
it("search", function(done) {
sphinx.query("select * from files where MATCH('bashaa')", (err, result) => {
if(!result)
throw new Error(err)
if(result.length !== 1)
throw new Error('not one result')
it("search", function(done) {
sphinx.query("select * from files where MATCH('bashaa')", (err, result) => {
if(!result)
throw new Error(err)
if(result.length !== 1)
throw new Error('not one result')
if(result[0].hash !== 'a')
throw new Error('not a in hash')
if(result[0].size !== 50)
throw new Error('not 50 in field')
if(result[0].hash !== 'a')
throw new Error('not a in hash')
if(result[0].size !== 50)
throw new Error('not 50 in field')
done()
})
})
done()
})
})
});