-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtest.js
31 lines (26 loc) · 829 Bytes
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/*!
* resolve-dir </~https://github.com/jonschlinkert/resolve-dir>
*
* Copyright (c) 2015 .
* Licensed under the MIT license.
*/
'use strict';
require('mocha');
var path = require('path');
var homedir = require('homedir-polyfill');
var assert = require('assert');
var gm = require('global-modules');
var resolve = require('./');
describe('resolve', function() {
it('should return a local directory path unchanged:', function() {
assert.equal(resolve('a'), 'a');
});
it('should resolve the path to user home:', function() {
assert.equal(resolve('~'), homedir());
assert.equal(resolve('~/foo'), path.join(homedir(), '/foo'));
});
it('should resolve the path to global npm modules:', function() {
assert.equal(resolve('@'), gm);
assert.equal(resolve('@/foo'), path.join(gm, '/foo'));
});
});