summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPiero Blunda <pieroblunda@gmail.com>2015-09-20 04:16:10 -0300
committerPiero Blunda <pieroblunda@gmail.com>2015-09-20 04:16:10 -0300
commit1d17258e4788e09d069878ed37a94e7cf5e723ec (patch)
treec3315406848c60493a6c59903e4c485a8a303bbe
parent89e88ed66a5b8471f7772bd5cc8685d7f13ca615 (diff)
downloadgit-hours-1d17258e4788e09d069878ed37a94e7cf5e723ec.zip
git-hours-1d17258e4788e09d069878ed37a94e7cf5e723ec.tar.gz
git-hours-1d17258e4788e09d069878ed37a94e7cf5e723ec.tar.bz2
Doing test
-rw-r--r--test/test-functional.js53
1 files changed, 52 insertions, 1 deletions
diff --git a/test/test-functional.js b/test/test-functional.js
index e91f281..64f5cfa 100644
--- a/test/test-functional.js
+++ b/test/test-functional.js
@@ -2,6 +2,8 @@ var _ = require('lodash');
var assert = require("assert");
var exec = require('child_process').exec;
+var totalHoursCount;
+
describe('git-hours', function() {
describe('cli', function() {
@@ -16,9 +18,58 @@ describe('git-hours', function() {
var work = JSON.parse(stdout);
assert.notEqual(work.total.hours.length, 0);
assert.notEqual(work.total.commits.length, 0);
-
+ totalHoursCount = work.total.hours;
done();
});
});
});
+
+ describe('Since option', function(){
+ it('Should analyse since today', function(done) {
+ exec('node index.js --since today', function(err, stdout, stderr) {
+ assert.ifError(err);
+ var work = JSON.parse(stdout);
+ assert.strictEqual(typeof work.total.hours, 'number');
+ done();
+ });
+ });
+
+ it('Should analyse since yesterday', function(done) {
+ exec('node index.js --since yesterday', function(err, stdout, stderr) {
+ assert.ifError(err);
+ var work = JSON.parse(stdout);
+ assert.strictEqual(typeof work.total.hours, 'number');
+ done();
+ });
+ });
+
+ it('Should analyse since last week', function(done){
+ exec('node index.js --since lastweek', function(err, stdout, stderr) {
+ assert.ifError(err);
+ var work = JSON.parse(stdout);
+ assert.strictEqual(typeof work.total.hours, 'number');
+ done();
+ });
+ });
+
+ it('Should analyse since a specific date', function(done){
+ exec('node index.js --since 2015-01-01', function(err, stdout, stderr) {
+ assert.ifError(err);
+ var work = JSON.parse(stdout);
+ assert.notEqual(work.total.hours, 0);
+ done();
+ });
+ });
+
+ it('Should analyse as without param', function(done){
+ exec('node index.js --since always', function(err, stdout, stderr) {
+ assert.ifError(err);
+ var work = JSON.parse(stdout);
+ assert.equal(work.total.hours, totalHoursCount);
+ done();
+ });
+ });
+ });
+
+
});