From 802fe47619e52a7ce89567e83745acd0db0b2b73 Mon Sep 17 00:00:00 2001 From: wltsmrz Date: Mon, 21 Oct 2013 13:14:26 -0700 Subject: [PATCH 1/3] Remove coffeescript compiler from mocha.opts until it is needed and added to dependencies --- test/mocha.opts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/mocha.opts b/test/mocha.opts index bc72ee58e1f..fef21b9a59a 100644 --- a/test/mocha.opts +++ b/test/mocha.opts @@ -1 +1 @@ ---reporter spec --compilers coffee:coffee-script --ui tdd --timeout 10000 --slow 600 \ No newline at end of file +--reporter spec --ui tdd --timeout 10000 --slow 600 From 5b39330ec3a82b96c1f4b0d53d84ac871bba6db9 Mon Sep 17 00:00:00 2001 From: wltsmrz Date: Thu, 24 Oct 2013 15:50:07 -0700 Subject: [PATCH 2/3] Add NoRipple test --- test/no-ripple-test.js | 128 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100644 test/no-ripple-test.js diff --git a/test/no-ripple-test.js b/test/no-ripple-test.js new file mode 100644 index 00000000000..218f8ede17c --- /dev/null +++ b/test/no-ripple-test.js @@ -0,0 +1,128 @@ +var async = require('async'); +var assert = require('assert'); +var Amount = require('ripple-lib').Amount; +var Remote = require('ripple-lib').Remote; +var Transaction = require('ripple-lib').Transaction; +var Server = require('./server').Server; +var testutils = require('./testutils'); +var config = testutils.init_config(); + +suite('TrustSet with NoRipple flag', function() { + var $ = { }; + + setup(function(done) { + testutils.build_setup().call($, done); + }); + + teardown(function(done) { + testutils.build_teardown().call($, done); + }); + + test('no-ripple', function(done) { + var self = this; + + var steps = [ + + function (callback) { + self.what = 'Create accounts.'; + testutils.create_accounts($.remote, 'root', '10000.0', [ 'alice' ], callback); + }, + + function (callback) { + self.what = 'Check a non-existent credit limit'; + + $.remote.request_ripple_balance('alice', 'mtgox', 'USD', 'CURRENT', function(err) { + assert.strictEqual('remoteError', err.error); + assert.strictEqual('entryNotFound', err.remote.error); + callback(); + }); + }, + + function (callback) { + self.what = 'Create a credit limit with NoRipple flag'; + + var tx = $.remote.transaction(); + tx.ripple_line_set('root', '100/USD/alice'); + tx.set_flags('NoRipple'); + + tx.once('error', callback); + tx.once('proposed', function(res) { + $.remote.ledger_accept(); + callback(); + }); + + tx.submit(); + }, + + function (callback) { + self.what = 'Check no-ripple sender'; + + $.remote.request_account_lines('root', void(0), 'CURRENT', function(err, m) { + if (err) return callback(err); + assert(typeof m === 'object'); + assert(Array.isArray(m.lines)); + assert(m.lines[0].no_ripple); + callback(); + }); + }, + + function (callback) { + self.what = 'Check no-ripple destination'; + + $.remote.request_account_lines('alice', void(0), 'CURRENT', function(err, m) { + if (err) return callback(err); + assert(typeof m === 'object'); + assert(Array.isArray(m.lines)); + assert(m.lines[0].no_ripple_peer); + callback(); + }); + }, + + function (callback) { + self.what = 'Create a credit limit with ClearNoRipple flag'; + + var tx = $.remote.transaction(); + tx.ripple_line_set('root', '100/USD/alice'); + tx.set_flags('ClearNoRipple'); + + tx.once('error', callback); + tx.once('proposed', function(res) { + $.remote.ledger_accept(); + callback(); + }); + + tx.submit(); + }, + + function (callback) { + self.what = 'Check no-ripple cleared sender'; + + $.remote.request_account_lines('root', void(0), 'CURRENT', function(err, m) { + if (err) return callback(err); + assert(typeof m === 'object'); + assert(Array.isArray(m.lines)); + assert(!m.lines[0].no_ripple); + callback(); + }); + }, + + function (callback) { + self.what = 'Check no-ripple cleared destination'; + + $.remote.request_account_lines('alice', void(0), 'CURRENT', function(err, m) { + if (err) return callback(err); + assert(typeof m === 'object'); + assert(Array.isArray(m.lines)); + assert(!m.lines[0].no_ripple_peer); + callback(); + }); + }, + ] + + async.series(steps, function(err) { + assert(!err, self.what); + done(); + }); + }); +}); + From 2d6799d8bd23e286bc3c312301d96bad75de25df Mon Sep 17 00:00:00 2001 From: wltsmrz Date: Thu, 24 Oct 2013 17:17:57 -0700 Subject: [PATCH 3/3] mtgox > root --- test/no-ripple-test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/no-ripple-test.js b/test/no-ripple-test.js index 218f8ede17c..012181af7b0 100644 --- a/test/no-ripple-test.js +++ b/test/no-ripple-test.js @@ -31,7 +31,7 @@ suite('TrustSet with NoRipple flag', function() { function (callback) { self.what = 'Check a non-existent credit limit'; - $.remote.request_ripple_balance('alice', 'mtgox', 'USD', 'CURRENT', function(err) { + $.remote.request_ripple_balance('alice', 'root', 'USD', 'CURRENT', function(err) { assert.strictEqual('remoteError', err.error); assert.strictEqual('entryNotFound', err.remote.error); callback();