diff --git a/package.json b/package.json index ef2c5a5f..43badbfa 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,9 @@ "grunt-contrib-watch": "~0.4.4", "grunt-webpack": "~0.10.5", "grunt-dox": "~0.5.0", - "mocha": "~1.14.0" + "mocha": "~1.14.0", + "sinon-chai": "~2.4.0", + "sinon":"~1.7.3" }, "scripts": { "test": "mocha test/*-test.js", diff --git a/src/js/ripple/remote.js b/src/js/ripple/remote.js index 9af383e8..895073db 100644 --- a/src/js/ripple/remote.js +++ b/src/js/ripple/remote.js @@ -1387,6 +1387,8 @@ Remote.prototype.requestUnlAdd = function(addr, comment, callback) { request.message.node = addr; if (comment) { + // note is not specified anywhere, should remove? + var note = undefined; request.message.comment = note; } diff --git a/test/remote-test.js b/test/remote-test.js new file mode 100644 index 00000000..6b8b60de --- /dev/null +++ b/test/remote-test.js @@ -0,0 +1,111 @@ +var assert = require('assert'); +var utils = require('./testutils'); +var sinon = require('sinon'); + +var Remote = utils.load_module('remote').Remote; +var Server = utils.load_module('server').Server; +var Request = utils.load_module('request').Request; + +var options, spy, mock, stub, remote, callback; + +describe("Remote", function () { + describe("initialing a remote with options", function () { + beforeEach(function () { + options = { + server: { + trace : true, + trusted: true, + local_signing: true, + secure: true, + servers: [ + { host: 's_west.ripple.com', port: 443, secure: true }, + { host: 's_east.ripple.com', port: 443, secure: true } + ], + + connection_offset: 0 + }, + + + host: 's_west.ripple.com', port: 443, secure: true, + blobvault : 'https://blobvault.payward.com', + persistent_auth : false, + transactions_per_page: 50, + + bridge: { + out: { + // 'bitcoin': 'localhost:3000' + // 'bitcoin': 'https://www.bitstamp.net/ripple/bridge/out/bitcoin/' + } + }, + + }; + }) + it("should add a server for each specified", function (done) { + var remote = new Remote(options); + done(); + }) + }) + + describe("functions that return request objects", function () { + beforeEach(function () { + callback = function () {} + remote = new Remote(options); + }); + + describe("requesting a ledger", function () { + it("should return a request", function (done) { + var request = remote.request_ledger(null, {}, callback); + assert(request instanceof Request); + done(); + }) + }); + + describe('requesting server info', function () { + it('should return a request object', function (done) { + var request = remote.request_server_info(null, {}, callback); + assert(request instanceof Request); + done(); + }) + }) + + describe('requesting peers', function () { + it('should return a request object', function (done) { + var request = remote.request_peers(null, {}, callback); + assert(request instanceof Request); + done(); + }); + }); + + describe('requesting a connection', function () { + it('should return a request object', function (done) { + var request = remote.request_connect(null, {}, callback); + assert(request instanceof Request); + done(); + }); + }); + + describe('making a unique node list add request', function () { + it('should return a request object', function (done) { + var request = remote.request_unl_add(null, {}, callback); + assert(request instanceof Request); + done(); + }); + }); + + describe('making a unique node list request', function () { + it('should return a request object', function (done) { + var request = remote.request_unl_list(null, {}, callback); + assert(request instanceof Request); + done(); + }); + }); + + describe('making a unique node list delete request', function () { + it('should return a request object', function (done) { + var request = remote.request_unl_delete(null, {}, callback); + assert(request instanceof Request); + done(); + }); + }); + }) +})