diff options
author | Florian Dold <florian.dold@gmail.com> | 2016-10-10 03:43:44 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2016-10-10 03:43:44 +0200 |
commit | abd94a7f5a50f43c797a11b53549ae48fff667c3 (patch) | |
tree | ab8ed457f65cdd72e13e0571d2975729428f1551 /node_modules/deprecated/test | |
parent | a0247c6a3fd6a09a41a7e35a3441324c4dcb58be (diff) | |
download | wallet-core-abd94a7f5a50f43c797a11b53549ae48fff667c3.tar.xz |
add node_modules to address #4364
Diffstat (limited to 'node_modules/deprecated/test')
-rw-r--r-- | node_modules/deprecated/test/field.js | 44 | ||||
-rw-r--r-- | node_modules/deprecated/test/method.js | 32 |
2 files changed, 76 insertions, 0 deletions
diff --git a/node_modules/deprecated/test/field.js b/node_modules/deprecated/test/field.js new file mode 100644 index 000000000..91a7029c7 --- /dev/null +++ b/node_modules/deprecated/test/field.js @@ -0,0 +1,44 @@ +var deprecated = require('../'); +var should = require('should'); +require('mocha'); + +describe('field()', function() { + it('should return a wrapped function that logs once on get', function(done) { + var message = 'testing'; + var scope = { + a: 1 + }; + var obj = {}; + var logged = false; + var log = function(msg){ + msg.should.equal(message); + logged.should.equal(false); + logged = true; + }; + deprecated.field(message, log, obj, 'a', 123); + + obj.a.should.equal(123); + obj.a = 1234; + obj.a.should.equal(1234); + logged.should.equal(true); + done(); + }); + it('should return a wrapped function that logs once on set', function(done) { + var message = 'testing'; + var scope = { + a: 1 + }; + var obj = {}; + var logged = false; + var log = function(msg){ + msg.should.equal(message); + logged.should.equal(false); + logged = true; + }; + deprecated.field(message, log, obj, 'a', 123); + + obj.a = 1234; + logged.should.equal(true); + done(); + }); +});
\ No newline at end of file diff --git a/node_modules/deprecated/test/method.js b/node_modules/deprecated/test/method.js new file mode 100644 index 000000000..615ba9454 --- /dev/null +++ b/node_modules/deprecated/test/method.js @@ -0,0 +1,32 @@ +var deprecated = require('../'); +var should = require('should'); +require('mocha'); + +describe('method()', function() { + it('should return a wrapped function that logs once', function(done) { + var message = 'testing'; + var scope = { + a: 1 + }; + var logged = false; + var log = function(msg){ + msg.should.equal(message); + logged.should.equal(false); + logged = true; + }; + var fn = deprecated.method(message, log, function(one, two){ + this.should.equal(scope); + one.should.equal(1); + two.should.equal(2); + return one+two; + }); + + fn.bind(scope)(1,2).should.equal(3); + fn.bind(scope)(1,2).should.equal(3); + fn.bind(scope)(1,2).should.equal(3); + fn.bind(scope)(1,2).should.equal(3); + + logged.should.equal(true); + done(); + }); +});
\ No newline at end of file |