re-added the newline, as well as another test case to make sure mode is still set to default value when a new file is opened

This commit is contained in:
Stephen Ward 2018-10-10 15:10:34 -04:00
parent ee67cb39de
commit 675773b92a
2 changed files with 17 additions and 0 deletions

View File

@ -1930,6 +1930,7 @@ function validateAndMaskMode(value, def, callback) {
callback = def;
def = undefined;
}
if (isUint32(value)) {
return value & FULL_READ_WRITE_EXEC_PERMISSIONS;
}

View File

@ -123,6 +123,22 @@ describe('fs.open', function() {
});
});
it('should create a new file, but no mode is passed, so the default value of 644 should be seen', function(done) {
var fs = util.fs();
fs.open('/myfile', 'w', function(error) {
if(error) throw error;
fs.stat('/myfile', function(error, result) {
expect(error).not.to.exist;
expect(result).to.exist;
expect(result.mode).to.exist;
expect(result.mode & 0o644).to.equal(0o644);
done();
});
});
});
/**
* This test is currently correct per our code, but incorrect according to the spec.
* When we fix https://github.com/filerjs/filer/issues/314 we'll have to update this.