Browse Source

test: modernize test-fs-truncate-fd

- changed `var` to `const` where variables were not reassigned.
- changed `assert.equal` to `assert.strictEqual` because there was no
downside to being more rigorous.

PR-URL: https://github.com/nodejs/node/pull/9978
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
v6.x
Nigel Kibodeaux 8 years ago
committed by Anna Henningsen
parent
commit
a749604e11
No known key found for this signature in database GPG Key ID: D8B9F5AEAE84E4CF
  1. 16
      test/parallel/test-fs-truncate-fd.js

16
test/parallel/test-fs-truncate-fd.js

@ -1,17 +1,17 @@
'use strict';
var common = require('../common');
var assert = require('assert');
var path = require('path');
var fs = require('fs');
var tmp = common.tmpDir;
const common = require('../common');
const assert = require('assert');
const path = require('path');
const fs = require('fs');
const tmp = common.tmpDir;
common.refreshTmpDir();
var filename = path.resolve(tmp, 'truncate-file.txt');
const filename = path.resolve(tmp, 'truncate-file.txt');
fs.writeFileSync(filename, 'hello world', 'utf8');
var fd = fs.openSync(filename, 'r+');
const fd = fs.openSync(filename, 'r+');
fs.truncate(fd, 5, common.mustCall(function(err) {
assert.ok(!err);
assert.equal(fs.readFileSync(filename, 'utf8'), 'hello');
assert.strictEqual(fs.readFileSync(filename, 'utf8'), 'hello');
}));
process.on('exit', function() {

Loading…
Cancel
Save