aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit
diff options
context:
space:
mode:
authorDan Finlay <dan@danfinlay.com>2016-11-29 09:27:20 +0800
committerDan Finlay <dan@danfinlay.com>2016-11-29 09:27:20 +0800
commit9e764b193517c935fa04d4722357cb48abcfb2a2 (patch)
tree3a94636ea384252118eb04cf42a7c11c7fc6cea4 /test/unit
parent80e76b45ee67900b5a60da1ddcd8b310f1e92413 (diff)
downloadtangerine-wallet-browser-9e764b193517c935fa04d4722357cb48abcfb2a2.tar
tangerine-wallet-browser-9e764b193517c935fa04d4722357cb48abcfb2a2.tar.gz
tangerine-wallet-browser-9e764b193517c935fa04d4722357cb48abcfb2a2.tar.bz2
tangerine-wallet-browser-9e764b193517c935fa04d4722357cb48abcfb2a2.tar.lz
tangerine-wallet-browser-9e764b193517c935fa04d4722357cb48abcfb2a2.tar.xz
tangerine-wallet-browser-9e764b193517c935fa04d4722357cb48abcfb2a2.tar.zst
tangerine-wallet-browser-9e764b193517c935fa04d4722357cb48abcfb2a2.zip
Fix nodeify
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/nodeify-test.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/unit/nodeify-test.js b/test/unit/nodeify-test.js
new file mode 100644
index 000000000..d4ac2ea0b
--- /dev/null
+++ b/test/unit/nodeify-test.js
@@ -0,0 +1,22 @@
+const assert = require('assert')
+const nodeify = require('../../app/scripts/lib/nodeify')
+
+describe.only('nodeify', function() {
+
+ var obj = {
+ foo: 'bar',
+ promiseFunc: function (a) {
+ var solution = this.foo + a
+ return Promise.resolve(solution)
+ }
+ }
+
+ it('should retain original context', function(done) {
+ var nodified = nodeify(obj.promiseFunc).bind(obj)
+ nodified('baz', function (err, res) {
+ assert.equal(res, 'barbaz')
+ done()
+ })
+ })
+
+})