forked from louischatriot/nedb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'no-dataloss-during-loaddatabase'
- Loading branch information
Showing
7 changed files
with
390 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
var should = require('chai').should() | ||
, assert = require('chai').assert | ||
, customUtils = require('../lib/customUtils') | ||
, fs = require('fs') | ||
; | ||
|
||
|
||
describe('customUtils', function () { | ||
|
||
describe('ensureFileDoesntExist', function () { | ||
|
||
it('Doesnt do anything if file already doesnt exist', function (done) { | ||
customUtils.ensureFileDoesntExist('workspace/nonexisting', function (err) { | ||
assert.isNull(err); | ||
fs.existsSync('workspace/nonexisting').should.equal(false); | ||
done(); | ||
}); | ||
}); | ||
|
||
it('Deletes file if it exists', function (done) { | ||
fs.writeFileSync('workspace/existing', 'hello world', 'utf8'); | ||
fs.existsSync('workspace/existing').should.equal(true); | ||
|
||
customUtils.ensureFileDoesntExist('workspace/existing', function (err) { | ||
assert.isNull(err); | ||
fs.existsSync('workspace/existing').should.equal(false); | ||
done(); | ||
}); | ||
}); | ||
|
||
}); | ||
|
||
|
||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
--reporter spec | ||
--timeout 2000 | ||
--timeout 10000 |
Oops, something went wrong.