2 /*global describe, it*/
5 var expect = require('chai').expect;
6 var esformatter = require('../lib/esformatter');
8 var input = 'var foo = bar;\nfunction bar(dolor, amet) {\n return dolor + amet;\n}';
9 var output1 = '\n// ---- esformatter-pipe-test-1 ---\n';
10 var output2 = '\n// ---- esformatter-pipe-test-2 ---\n';
12 describe('pipe', function() {
14 it('should call piped commands', function() {
15 var out = esformatter.format(input, {
18 'esformatter-pipe-test-1',
21 'esformatter-pipe-test-2'
25 expect(out).to.eql(input + output1 + output2);
28 it('should call piped commands in order', function() {
29 var out = esformatter.format(input, {
32 'esformatter-pipe-test-2',
33 'esformatter-pipe-test-1'
37 expect(out).to.eql(input + output2 + output1);
40 it('should throw error if command not found', function() {
42 esformatter.format(input, {
45 'esformatter-fake-pipe-command'