Skip to content

Commit

Permalink
update tests for latest AVA version
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Dec 31, 2015
1 parent bb584ea commit 0e4205e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 25 deletions.
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -13,7 +13,7 @@
"node": ">=0.10.0"
},
"scripts": {
"test": "node test.js"
"test": "ava"
},
"files": [
"index.js"
Expand All @@ -33,6 +33,6 @@
"os-homedir": "^1.0.0"
},
"devDependencies": {
"ava": "0.0.4"
"ava": "*"
}
}
42 changes: 19 additions & 23 deletions test.js
@@ -1,32 +1,28 @@
'use strict';
var test = require('ava');
var tildify = require('./');
var path = require('path');
var osHomedir = require('os-homedir');
var home = osHomedir();
const test = require('ava');
const tildify = require('./');
const path = require('path');
const osHomedir = require('os-homedir');
const home = osHomedir();

test('tildify home', function (t) {
var fixture = home;
t.assert(tildify(fixture) === '~');
t.end();
test('tildify home', t => {
const fixture = home;
t.is(tildify(fixture), '~');
});

test('tildify path', function (t) {
var fixture = path.resolve(home, 'tildify');
t.assert(tildify(fixture)[0] === '~');
t.assert(/tildify$/.test(tildify(fixture)));
t.assert(tildify(fixture) !== fixture);
t.end();
test('tildify path', t => {
const fixture = path.resolve(home, 'tildify');
t.is(tildify(fixture)[0], '~');
t.true(/tildify$/.test(tildify(fixture)));
t.not(tildify(fixture), fixture);
});

test('ensure only a fully matching path is replaced', function (t) {
var fixture = path.resolve(home + 'foo', 'tildify');
t.assert(tildify(fixture) === fixture);
t.end();
test('ensure only a fully matching path is replaced', t => {
const fixture = path.resolve(`${home}foo`, 'tildify');
t.is(tildify(fixture), fixture);
});

test('ignore relative paths', function (t) {
var fixture = 'tildify';
t.assert(tildify(fixture) === fixture);
t.end();
test('ignore relative paths', t => {
const fixture = 'tildify';
t.is(tildify(fixture), fixture);
});

0 comments on commit 0e4205e

Please sign in to comment.