@ -6,8 +6,10 @@ var should = require('chai').should()
,_=require('underscore')
,async=require('async')
,model=require('../lib/model')
,customUtils=require('../lib/customUtils')
,Datastore=require('../lib/datastore')
,Persistence=require('../lib/persistence')
,child_process=require('child_process')
;
@ -248,4 +250,33 @@ describe('Persistence', function () {
});
});
// This test is a bit complicated since it depends on the time actions take to execute
// It may not work as expected on all machines
// But it will not be seen as a failed test. The worst is that the timing is off and it would have worked on your machine regardless of the load failsafe
// It is timed for my dev machine
describe.only('Prevent dataloss when persisting data',function(){
it('If system crashes during a loadDatabase, the former version is not lost',function(done){
varcp,N=150000,toWrite="",i;
// Creating a db file with 150k records (a bit long to load)