added test to fs.open for creating a file with bitwise flag

This commit is contained in:
rscotchmer 2019-04-10 15:34:05 -04:00
parent 75cbd74b59
commit 64d9f452ba
1 changed files with 12 additions and 0 deletions

View File

@ -1,6 +1,7 @@
var util = require('../lib/test-utils.js'); var util = require('../lib/test-utils.js');
var expect = require('chai').expect; var expect = require('chai').expect;
var { FIRST_DESCRIPTOR } = require('../../src/constants.js'); var { FIRST_DESCRIPTOR } = require('../../src/constants.js');
var Constants = require('../../src/constants.js');
describe('fs.open', function() { describe('fs.open', function() {
beforeEach(util.setup); beforeEach(util.setup);
@ -33,6 +34,17 @@ describe('fs.open', function() {
}); });
}); });
it('should create a file when passed the flag as a bitwise number', function(done) {
var fs = util.fs();
fs.open('/myfile', Constants.fsConstants.O_CREAT, function(error, fd) {
expect(error).not.to.exist;
expect(fd).to.exist;
fs.close(fd);
done();
});
});
it('should return an error when flagged for write and the path is a directory', function(done) { it('should return an error when flagged for write and the path is a directory', function(done) {
var fs = util.fs(); var fs = util.fs();