From d2fc3121787ffa4b3ca2df8eb3d57d44f49047e9 Mon Sep 17 00:00:00 2001 From: Robert-Frampton Date: Fri, 24 Mar 2017 09:56:57 -0700 Subject: [PATCH] Add test for custom outputDir --- test/lib/pipelines/compileSoy.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/test/lib/pipelines/compileSoy.js b/test/lib/pipelines/compileSoy.js index bcec3d26..0a26eba7 100644 --- a/test/lib/pipelines/compileSoy.js +++ b/test/lib/pipelines/compileSoy.js @@ -3,11 +3,21 @@ var assert = require('assert'); var childProcess = require('child_process'); var compileSoy = require('../../../lib/pipelines/compileSoy'); +var del = require('del'); var ignore = require('gulp-ignore'); +var path = require('path'); var sinon = require('sinon'); var vfs = require('vinyl-fs'); +var outputDir = path.join(__dirname, '../../tmp'); + describe('Compile Soy Pipeline', function() { + after(function(done) { + del(outputDir).then(function() { + done(); + }); + }); + it('should compile soy files to js', function(done) { var stream = vfs.src('test/fixtures/soy/simple.soy') .pipe(compileSoy()); @@ -17,6 +27,18 @@ describe('Compile Soy Pipeline', function() { }); }); + it('should compile soy files to js using custom outputDir', function(done) { + var stream = vfs.src('test/fixtures/soy/simple.soy') + .pipe(compileSoy({ + outputDir: outputDir + })); + + stream.on('data', function(file) { + assert.strictEqual('simple.soy.js', file.relative); + done(); + }); + }); + it('should not throw error if no files are provided for compilation', function(done) { var stream = vfs.src('test/fixtures/soy/simple.soy') .pipe(ignore.exclude('*.soy'))