From 64d9f452baf8e6056b016340a120cf46fdc104f4 Mon Sep 17 00:00:00 2001 From: rscotchmer Date: Wed, 10 Apr 2019 15:34:05 -0400 Subject: [PATCH] added test to fs.open for creating a file with bitwise flag --- tests/spec/fs.open.spec.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/spec/fs.open.spec.js b/tests/spec/fs.open.spec.js index 819b1ba..241faf8 100644 --- a/tests/spec/fs.open.spec.js +++ b/tests/spec/fs.open.spec.js @@ -1,6 +1,7 @@ var util = require('../lib/test-utils.js'); var expect = require('chai').expect; var { FIRST_DESCRIPTOR } = require('../../src/constants.js'); +var Constants = require('../../src/constants.js'); describe('fs.open', function() { 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) { var fs = util.fs();