fix tests to not delete folder while running

This commit is contained in:
Mark Nadal 2019-04-25 20:10:04 -07:00
parent ecffdce786
commit da431c06bc
2 changed files with 9 additions and 12 deletions

View File

@ -7,13 +7,12 @@ var Gun;
root = env.window? env.window : global; root = env.window? env.window : global;
try{ env.window && root.localStorage && root.localStorage.clear() }catch(e){} try{ env.window && root.localStorage && root.localStorage.clear() }catch(e){}
try{ indexedDB.deleteDatabase('radatatest') }catch(e){} try{ indexedDB.deleteDatabase('radatatest') }catch(e){}
try{ require('fs').unlinkSync('data.json') }catch(e){}
try{ require('../../lib/fsrm')('radatatest') }catch(e){}
//root.Gun = root.Gun || require('../gun');
if(root.Gun){ if(root.Gun){
root.Gun = root.Gun; root.Gun = root.Gun;
root.Gun.TESTING = true; root.Gun.TESTING = true;
} else { } else {
try{ require('fs').unlinkSync('data.json') }catch(e){}
try{ require('../../lib/fsrm')('radatatest') }catch(e){}
root.Gun = require('../../gun'); root.Gun = require('../../gun');
root.Gun.TESTING = true; root.Gun.TESTING = true;
//require('../lib/file'); //require('../lib/file');

View File

@ -7,24 +7,22 @@ var Gun;
root = env.window? env.window : global; root = env.window? env.window : global;
try{ env.window && root.localStorage && root.localStorage.clear() }catch(e){} try{ env.window && root.localStorage && root.localStorage.clear() }catch(e){}
try{ indexedDB.deleteDatabase('radatatest') }catch(e){} try{ indexedDB.deleteDatabase('radatatest') }catch(e){}
try{ require('fs').unlinkSync('data.json') }catch(e){}
try{ require('../../lib/fsrm')('radatatest') }catch(e){}
//root.Gun = root.Gun || require('../gun');
if(root.Gun){ if(root.Gun){
root.Gun = root.Gun; root.Gun = root.Gun;
root.Gun.TESTING = true; root.Gun.TESTING = true;
} else { } else {
try{ require('fs').unlinkSync('data.json') }catch(e){}
try{ require('../../lib/fsrm')('radatatest') }catch(e){}
root.Gun = require('../../gun'); root.Gun = require('../../gun');
root.Gun.TESTING = true; root.Gun.TESTING = true;
//require('../lib/file'); //require('../lib/file');
require('../lib/store'); require('../../lib/store');
require('../lib/rfs'); require('../../lib/rfs');
} }
if(root.Gun.SEA){ try{ var expect = global.expect = require("../expect") }catch(e){}
//Gun = root.Gun = root.Gun;
} else { if(!root.Gun.SEA){
var expect = global.expect = require("../expect");
require('../../sea.js'); require('../../sea.js');
} }
}(this)); }(this));