bitcoin errors should pass err object in callback

This commit is contained in:
freewil 2012-02-23 00:10:33 -05:00
parent 53d0381984
commit 79ab65759a
3 changed files with 23 additions and 11 deletions

3
.gitignore vendored
View File

@ -1 +1,2 @@
node_modules
node_modules/
test/config.js

View File

@ -6,12 +6,7 @@ var test = {
account: "test"
};
var config = {
host: 'localhost',
port: 8332,
user: 'jb55',
pass: 'thisisthepassword'
};
var config = require('./config');
// end test variables
@ -143,9 +138,19 @@ vows.describe('api').addBatch({
}
}
}
},
"creating a bitcoin related error": {
topic: function(client) {
client.cmd('nomethod', this.callback);
},
"should create non-null err in callback": function(err, expectedValue) {
assert.deepEqual(err, {
code: -32601,
message: 'Method not found'
});
assert.equal(expectedValue, undefined);
}
}
},
}
}).export(module);

6
test/config.example.js Normal file
View File

@ -0,0 +1,6 @@
module.exports = {
host: 'localhost',
port: 8332,
user: 'jb55',
pass: 'thisisthepassword'
};