Increase coverage: check for non-int with chown/fchown
This commit is contained in:
parent
43d2632069
commit
cc6e3f7edf
|
@ -27,6 +27,62 @@ describe('fs.chown, fs.fchown', function() {
|
|||
});
|
||||
});
|
||||
|
||||
it('fchown should expect an interger value for uid', function(done) {
|
||||
var fs = util.fs();
|
||||
|
||||
fs.open('/file', 'w', function(err, fd) {
|
||||
if(err) throw err;
|
||||
|
||||
fs.fchown(fd, '1001', 1001, function(err) {
|
||||
expect(err).to.exist;
|
||||
expect(err.code).to.equal('EINVAL');
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('chown should expect an interger value for uid', function(done) {
|
||||
var fs = util.fs();
|
||||
|
||||
fs.writeFile('/file', 'w', function(err) {
|
||||
if(err) throw err;
|
||||
|
||||
fs.chown('/file', '1001', 1001, function(err) {
|
||||
expect(err).to.exist;
|
||||
expect(err.code).to.equal('EINVAL');
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('fchown should expect an interger value for gid', function(done) {
|
||||
var fs = util.fs();
|
||||
|
||||
fs.open('/file', 'w', function(err, fd) {
|
||||
if(err) throw err;
|
||||
|
||||
fs.fchown(fd, 1001, '1001', function(err) {
|
||||
expect(err).to.exist;
|
||||
expect(err.code).to.equal('EINVAL');
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('chown should expect an interger value for gid', function(done) {
|
||||
var fs = util.fs();
|
||||
|
||||
fs.writeFile('/file', 'w', function(err) {
|
||||
if(err) throw err;
|
||||
|
||||
fs.chown('/file', 1001, '1001', function(err) {
|
||||
expect(err).to.exist;
|
||||
expect(err.code).to.equal('EINVAL');
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('should allow updating gid and uid for a file', function(done) {
|
||||
var fs = util.fs();
|
||||
|
||||
|
|
Loading…
Reference in New Issue