File: test.js

package info (click to toggle)
node-expand-tilde 2.0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 108 kB
  • ctags: 9
  • sloc: makefile: 4; sh: 2
file content (21 lines) | stat: -rw-r--r-- 566 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
'use strict';

require('mocha');
var isWindows = require('is-windows');
var os = require('os');
var assert = require('assert');
var path = require('path');
path.sep = '/';

var expandTilde = require('./');

if (!isWindows()) {
  it('should expand a tilde to the user home directory', function() {
    assert.equal(expandTilde('~'), os.homedir());
  });

  it('should expand `~+` to process.cwd, per bash spec', function() {
    assert.equal(expandTilde('~+'), process.cwd());
    assert.equal(expandTilde('~+/foo/bar'), path.join(process.cwd(), 'foo/bar'));
  });
}