diff options
Diffstat (limited to 'node_modules/deprecated/test/field.js')
-rw-r--r-- | node_modules/deprecated/test/field.js | 44 |
1 files changed, 44 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 |