From c41446b1318801816428550232d6950da3e975e8 Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Thu, 9 Jan 2014 19:49:48 -0300 Subject: [PATCH] Enhacements in gruntfile --- Gruntfile.js | 29 ++++++++++++++++++----------- app/models/Transaction.js | 1 - config/env/test.js | 15 +++++++++++---- test/model/block.js | 4 ++-- 4 files changed, 31 insertions(+), 18 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index ab534a1..bd6d921 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -1,6 +1,16 @@ 'use strict'; module.exports = function(grunt) { + + + //Load NPM tasks + grunt.loadNpmTasks('grunt-contrib-watch'); + grunt.loadNpmTasks('grunt-contrib-jshint'); + grunt.loadNpmTasks('grunt-mocha-test'); + grunt.loadNpmTasks('grunt-nodemon'); + grunt.loadNpmTasks('grunt-concurrent'); + grunt.loadNpmTasks('grunt-env'); + // Project Configuration grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), @@ -29,6 +39,11 @@ module.exports = function(grunt) { options: { livereload: true } + }, + test: { + // we monitor only app/models/* because we have test for models only now + files: ['test/**/*.js', 'test/*.js','app/models/*.js'], + tasks: ['test'], } }, jshint: { @@ -43,7 +58,7 @@ module.exports = function(grunt) { options: { reporter: 'spec', }, - src: ['test/*.js'] + src: ['test/**/*.js'], }, nodemon: { @@ -51,9 +66,9 @@ module.exports = function(grunt) { options: { file: 'server.js', args: [], - ignoredFiles: ['public/**'], + ignoredFiles: ['public/**', 'test/**'], watchedExtensions: ['js'], - nodeArgs: ['--debug'], + // nodeArgs: ['--debug'], delayTime: 1, env: { PORT: 3000 @@ -75,14 +90,6 @@ module.exports = function(grunt) { } }); - //Load NPM tasks - grunt.loadNpmTasks('grunt-contrib-watch'); - grunt.loadNpmTasks('grunt-contrib-jshint'); - grunt.loadNpmTasks('grunt-mocha-test'); - grunt.loadNpmTasks('grunt-nodemon'); - grunt.loadNpmTasks('grunt-concurrent'); - grunt.loadNpmTasks('grunt-env'); - //Making grunt default to force in order not to break the project. grunt.option('force', true); diff --git a/app/models/Transaction.js b/app/models/Transaction.js index e48bd1b..e80ab5b 100644 --- a/app/models/Transaction.js +++ b/app/models/Transaction.js @@ -181,7 +181,6 @@ TransactionSchema.methods.queryInfo = function (next) { }); } - tx.outs.forEach( function(i) { var n = util.valueToBigInt(i.v).toNumber(); valueOut = valueOut.add(n); diff --git a/config/env/test.js b/config/env/test.js index dabf602..902efe9 100755 --- a/config/env/test.js +++ b/config/env/test.js @@ -1,9 +1,16 @@ 'use strict'; module.exports = { - db: "mongodb://localhost/mystery-test", - port: 3001, + db: "mongodb://localhost/mystery-dev", app: { name: "Mystery - Test" - } -} \ No newline at end of file + }, + bitcoind: { + user: 'mystery', + pass: 'real_mystery', + protocol: 'http', + host: process.env.BITCOIND_HOST || '127.0.0.1', + port: process.env.BITCOIND_PORT || '8332', + }, + network: 'testnet', +} diff --git a/test/model/block.js b/test/model/block.js index 7fa2a30..1f4a798 100644 --- a/test/model/block.js +++ b/test/model/block.js @@ -26,10 +26,9 @@ describe('Block fromHashWithInfo', function(){ done(); }); + it('should poll block\'s info from mongoose', function(done) { -console.log('asdasd'); var block2 = Block.fromHashWithInfo(TESTING_BLOCK, function(err, b2) { -console.log('333'); if (err) done(err); assert.equal(b2.hash, TESTING_BLOCK); @@ -37,6 +36,7 @@ console.log('333'); }); }); + it('should poll block\'s info from bitcoind', function(done) { var block2 = Block.fromHashWithInfo(TESTING_BLOCK, function(err, b2) { if (err) done(err);