Browse Source

Update filepaths to work with latest AVA

pull/3/head
Luke Childs 7 years ago
parent
commit
73bcdd0b7a
  1. 14
      test/unit.js

14
test/unit.js

@ -4,9 +4,9 @@ import { readFileSync } from 'fs';
import { exec } from 'child-process-promise'; import { exec } from 'child-process-promise';
import htconvert from '../dist/htconvert'; import htconvert from '../dist/htconvert';
const inputPath = './fixtures/input'; const inputPath = './test/fixtures/input';
const input = readFileSync(inputPath, 'utf-8'); const input = readFileSync(inputPath, 'utf-8');
const output = readFileSync('./fixtures/output', 'utf-8'); const output = readFileSync('./test/fixtures/output', 'utf-8');
test('htconvert should export a function', t => { test('htconvert should export a function', t => {
t.is(typeof htconvert, 'function'); t.is(typeof htconvert, 'function');
@ -17,27 +17,27 @@ test('htconvert should match input with output', t => {
}); });
test('cli input with -f arg', t => { test('cli input with -f arg', t => {
return exec(`node ../dist/cli.js -f ${inputPath}`).then(result => { return exec(`node dist/cli.js -f ${inputPath}`).then(result => {
t.is(result.stdout, output+'\n'); t.is(result.stdout, output+'\n');
}); });
}); });
test('cli input with --file arg', t => { test('cli input with --file arg', t => {
return exec(`node ../dist/cli.js --file ${inputPath}`).then(result => { return exec(`node dist/cli.js --file ${inputPath}`).then(result => {
t.is(result.stdout, output+'\n'); t.is(result.stdout, output+'\n');
}); });
}); });
test('cli input from stdin', t => { test('cli input from stdin', t => {
return exec(`echo "${input}" | node ../dist/cli.js`).then(result => { return exec(`echo "${input}" | node dist/cli.js`).then(result => {
t.is(result.stdout, output+'\n\n'); t.is(result.stdout, output+'\n\n');
}); });
}); });
test('cli should show help if stdin and file input are empty', t => { test('cli should show help if stdin and file input are empty', t => {
const commands = []; const commands = [];
commands.push(exec('node ../dist/cli.js')); commands.push(exec('node dist/cli.js'));
commands.push(exec('node ../dist/cli.js --help')); commands.push(exec('node dist/cli.js --help'));
// We ned to manually stop listening on stdin // We ned to manually stop listening on stdin
// This happens automatically when ran from terminal // This happens automatically when ran from terminal

Loading…
Cancel
Save