wallet-core/node_modules/resolve/test/dotdot.js

30 lines
799 B
JavaScript
Raw Normal View History

2016-10-10 03:43:44 +02:00
var path = require('path');
var test = require('tape');
var resolve = require('../');
test('dotdot', function (t) {
t.plan(4);
2017-05-28 00:38:50 +02:00
var dir = path.join(__dirname, '/dotdot/abc');
resolve('..', { basedir: dir }, function (err, res, pkg) {
2016-10-10 03:43:44 +02:00
t.ifError(err);
2017-05-28 00:38:50 +02:00
t.equal(res, path.join(__dirname, 'dotdot/index.js'));
2016-10-10 03:43:44 +02:00
});
2017-05-28 00:38:50 +02:00
resolve('.', { basedir: dir }, function (err, res, pkg) {
2016-10-10 03:43:44 +02:00
t.ifError(err);
2017-05-28 00:38:50 +02:00
t.equal(res, path.join(dir, 'index.js'));
2016-10-10 03:43:44 +02:00
});
});
test('dotdot sync', function (t) {
t.plan(2);
2017-05-28 00:38:50 +02:00
var dir = path.join(__dirname, '/dotdot/abc');
var a = resolve.sync('..', { basedir: dir });
t.equal(a, path.join(__dirname, 'dotdot/index.js'));
var b = resolve.sync('.', { basedir: dir });
t.equal(b, path.join(dir, 'index.js'));
2016-10-10 03:43:44 +02:00
});