node/test/parallel/test-fs-symlink-dir-junction.js
Walter Beller-Morales 1877ba3384 test: refactor test-fs-symlink-dir-junction
* var -> const
* assert.equal() -> assert.strictEqual()

PR-URL: https://github.com/nodejs/node/pull/9928
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-12-06 13:51:57 -05:00

34 lines
983 B
JavaScript

'use strict';
const common = require('../common');
const assert = require('assert');
const path = require('path');
const fs = require('fs');
// test creating and reading symbolic link
const linkData = path.join(common.fixturesDir, 'cycles/');
const linkPath = path.join(common.tmpDir, 'cycles_link');
common.refreshTmpDir();
console.log('linkData: ' + linkData);
console.log('linkPath: ' + linkPath);
fs.symlink(linkData, linkPath, 'junction', common.mustCall(function(err) {
if (err) throw err;
fs.lstat(linkPath, common.mustCall(function(err, stats) {
if (err) throw err;
assert.ok(stats.isSymbolicLink());
fs.readlink(linkPath, common.mustCall(function(err, destination) {
if (err) throw err;
assert.strictEqual(destination, linkData);
fs.unlink(linkPath, common.mustCall(function(err) {
if (err) throw err;
assert(!common.fileExists(linkPath));
assert(common.fileExists(linkData));
}));
}));
}));
}));