feat(tests): db test
This commit is contained in:
@ -152,6 +152,28 @@ const writeSphinxConfig = (path) => {
|
||||
}
|
||||
`;
|
||||
|
||||
// clear dir in test env
|
||||
if(env.name === 'test')
|
||||
{
|
||||
if (fs.existsSync(`${path}/database`)) {
|
||||
fs.readdirSync(`${path}/database`).forEach(function(file, index){
|
||||
const curPath = `${path}/database` + "/" + file;
|
||||
if (!fs.lstatSync(curPath).isDirectory()) {
|
||||
fs.unlinkSync(curPath);
|
||||
}
|
||||
});
|
||||
|
||||
fs.readdirSync(path).forEach(function(file, index){
|
||||
if(!file.startsWith('binlog'))
|
||||
return;
|
||||
const curPath = path + "/" + file;
|
||||
if (!fs.lstatSync(curPath).isDirectory()) {
|
||||
fs.unlinkSync(curPath);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (!fs.existsSync(`${path}/database`)){
|
||||
fs.mkdirSync(`${path}/database`);
|
||||
}
|
||||
|
@ -42,10 +42,10 @@ let config = {
|
||||
const fs = require('fs');
|
||||
const debug = require('debug')('config')
|
||||
|
||||
let configPath = 'config.json'
|
||||
let configPath = 'rats.json'
|
||||
if(app && app.getPath("userData") && app.getPath("userData").length > 0)
|
||||
{
|
||||
configPath = app.getPath("userData") + '/config.json'
|
||||
configPath = app.getPath("userData") + '/rats.json'
|
||||
}
|
||||
|
||||
const configProxy = new Proxy(config, {
|
||||
|
@ -1,3 +0,0 @@
|
||||
{
|
||||
"indexer": true
|
||||
}
|
Reference in New Issue
Block a user