Ver Fonte

Bumped version to 1.0.1

Jannick Knudsen há 6 anos atrás
pai
commit
103567e1d1
5 ficheiros alterados com 44 adições e 40 exclusões
  1. 1 1
      VERSION
  2. 1 0
      VERSIONLOG
  3. 0 4
      lib/actionsfilters.js
  4. 1 1
      package.json
  5. 41 34
      test/tools2.test.js

+ 1 - 1
VERSION

@@ -1 +1 @@
-v0.0.3 | Mon Nov 12 23:55:17 CET 2018 | init
+v1.0.1

+ 1 - 0
VERSIONLOG

@@ -1,3 +1,4 @@
 v0.0.1
 v0.0.2
 v0.0.3 | Mon Nov 12 23:55:17 CET 2018 | init
+v1.0.1

+ 0 - 4
lib/actionsfilters.js

@@ -77,10 +77,6 @@ module.exports = function create_tool() {
         } else {
             arr = apply_filters(filtername, []);
         }
-        console.log("AAAAAAAAAAAAAAAAAAAAAAAAA", filtername);
-        console.log("AAAAAAAAAAAAAAAAAAAAAAAAA", arr);
-        console.log("AAAAAAAAAAAAAAAAAAAAAAAAA", restargs);
-
         async.mapSeries(arr, function(func, next) {
             func.apply(func, restargs.concat(next));
         }, cb)

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
     "name": "tools2",
-    "version": "1.0.0",
+    "version": "1.0.1",
     "description": "",
     "main": "index.js",
     "scripts": {

+ 41 - 34
test/tools2.test.js

@@ -13,8 +13,7 @@
 
                 it('Can add an `action` function to be called with do_action', function(done) {
                     var tool = tools();
-                    console.log(tool);
-                    
+
                     tool.add_action("test", function() {
                         expect(true)
                         done();
@@ -57,7 +56,7 @@
                 });
 
 
-                it('Can add an `action` function to be called with do_action with extra arguments sorted',
+                it('Can add an `action` function to be called with do_action with extra arguments sorted tool.do_action("test", "hello")',
                     function(done) {
                         var tool = tools();
                         var iii = 0;
@@ -91,7 +90,7 @@
             })
 
             describe('add_filters apply_filters', function() {
-                it('Can add an `filter` function to be called with apply_filters ARRAY', function(done) {
+                it('Can add an `filter` function to be called with apply_filters ARRAY tool.apply_filters("test", [])', function(done) {
                     var tool = tools();
                     tool.add_filters("test", function(a) {
                         a.push("test");
@@ -105,7 +104,7 @@
                 });
 
 
-                it('Can add an `filter` function to be called with apply_filters ARRAY sorted', function(done) {
+                it('Can add an `filter` function to be called with apply_filters ARRAY sorted tool.apply_filters("test", [])', function(done) {
                     var tool = tools();
                     tool.add_filters("test", function(a) {
                         a.push("test");
@@ -122,15 +121,15 @@
                     done();
                 });
 
-                it('Can add an `filter` function to be called with apply_filters ARRAY sorted 2', function(done) {
+                it('Can add an `filter` function to be called with apply_filters ARRAY sorted 2 tool.apply_filters("test", ["1", "2", "3"])', function(done) {
                     var tool = tools();
                     tool.add_filters("test", function(a) {
-                        if(a.length>0){
-                            a[0]=a[0]+":1";
+                        if (a.length > 0) {
+                            a[0] = a[0] + ":1";
                         }
                         return a;
                     }, 10);
-                    var t = tool.apply_filters("test", ["1","2","3"]);
+                    var t = tool.apply_filters("test", ["1", "2", "3"]);
                     expect(t).to.be.an('array');
                     expect(t.length).to.equal(3);
                     expect(t[0]).to.equal("1:1");
@@ -139,46 +138,54 @@
 
 
 
-                it('Can add an `filter` function to be called with apply_filters ARRAY sorted', function(done) {
+                it('Can add an `filter` function to be called with apply_filters ARRAY of functions that callback   tool.apply_filters_map(["test",...], inputfunc, done)', function(done) {
                     var tool = tools();
-                    tool.add_filters("test", function(a) {
-                        a.push(function(b, cb) {
-                            console.log("LLL", arguments);
-                            cb(null, b())
+                    var externalfunca = function(a) {
+                        return {
+                            objectcreatebyletssay: "mysql",
+                            status: "MAYBE"
+                        }
+                    };
+                    tool.add_filters("test", function(filterarray) {
+                        filterarray.push(function(inputfunction, cb) {
+                            cb(null, inputfunction(externalfunca()))
                         })
-                        return a;
+                        return filterarray;
                     }, 10);
-                    tool.add_filters("test", function(a) {
-                        a.push(function(b, cb) {
-                            console.log("oooo", arguments);
-                            cb(null, b())
+                    tool.add_filters("test", function(filterarray) {
+                        filterarray.push(function(inputfunction, cb) {
+                            cb(null, inputfunction({
+                                status: "YES"
+                            }))
                         })
 
-                        return a;
+                        return filterarray;
                     }, 5);
-                    tool.add_filters("testaa", function(a) {
-                        a.push(function(b, cb) {
-                            console.log("aaa", arguments);
-                            cb(null, b())
+                    tool.add_filters("testaa", function(filterarray) {
+                        filterarray.push(function(inputfunction, cb) {
+                            cb(null, inputfunction({
+                                status: "NO"
+                            }))
                         })
 
-                        return a;
+                        return filterarray;
                     }, 5);
-                    
 
-                    var t = tool.apply_filters_map(["test","testaa"],function(ao){
-                    		console.log("OOOOOAAA",ao)
 
+                    var t = tool.apply_filters_map(["test", "testaa"], function imtheinputfunction(ao) {
+                        return ao
                     }, function(err, result) {
-                        console.log("JJJJJJJJJJJJ", arguments);
+                        expect(result).to.be.an('array');
+                        expect(result.length).to.equal(3);
+                        expect(result[0]).to.be.an('object');
+                        expect(result[1].objectcreatebyletssay).to.be.an('string');
+                        expect(result[1].objectcreatebyletssay).to.equal('mysql');
+
+                        done();
+
 
                     });
-                    console.log(t);
 
-                    expect(t).to.be.an('array');
-                    expect(t.length).to.equal(2);
-                    expect(t[0]).to.equal("test2");
-                    done();
                 });