add better tests and coverage

This commit is contained in:
2016-02-12 05:36:23 +01:00
parent dcdf0059cc
commit 57350d6fee
10 changed files with 69 additions and 41 deletions

6
test/test.d.ts vendored Normal file
View File

@ -0,0 +1,6 @@
/// <reference path="ts/typings/main.d.ts" />
declare var gulp: any;
declare var gulpFunction: any;
declare var beautylog: any;
declare var myFunction: () => void;
declare var myFunction2: () => void;

View File

@ -1,17 +1,30 @@
#!/usr/bin/env node
/// <reference path="typings/main.d.ts" />
var gulp = require("gulp");
var gulpFunction = require("../index.js");
var beautylog = require("beautylog");
var myFunction = function () {
beautylog.log("Mocha Test successfull!");
beautylog.log("Function executed");
};
var myFunction2 = function () {
beautylog.log("Function2 executed");
};
describe("gulpFunction", function () {
it("should run through smoothly", function () {
gulp.task('default', function () {
gulp.src('./test/test.md')
.pipe(gulpFunction(myFunction, 'forEach'))
.pipe(gulp.dest("./test/result/"));
});
gulp.start.apply(gulp, ['default']);
it("should run through smoothly with " + "'forEach'".blue, function () {
gulp.src('./test/*.md')
.pipe(gulpFunction(myFunction, 'forEach'))
.pipe(gulp.dest("./test/result/"));
gulp.src('./test/*.md')
.pipe(gulpFunction([myFunction, myFunction2], 'forEach'))
.pipe(gulp.dest("./test/result/"));
});
it("should run through smoothly with " + "'atEnd'".blue, function () {
gulp.src('./test/*.md')
.pipe(gulpFunction(myFunction, 'atEnd'))
.pipe(gulp.dest("./test/result/"));
gulp.src('./test/*.md')
.pipe(gulpFunction([myFunction, myFunction2], 'atEnd'))
.pipe(gulp.dest("./test/result/"));
});
});

2
test/test02.md Normal file
View File

@ -0,0 +1,2 @@
# Test.md
This is another test file for the test.js gulp pipeline