Skip to content

Commit

Permalink
Test compiled code in dist/npm on CI server
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Clark committed Aug 6, 2015
1 parent 89e5f79 commit 194b73c
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 11 deletions.
6 changes: 6 additions & 0 deletions bin/ci.sh
Expand Up @@ -16,8 +16,14 @@ lint() {
}

unittest() {
# test "src"
npm test --coverage
npm run coveralls

# test compiled version in "dist/npm"
ln -nfs ../../dist/npm/core test/node_modules/ripple-lib
ln -nfs ../../dist/npm test/node_modules/ripple-api
npm test
}

oneNode() {
Expand Down
13 changes: 10 additions & 3 deletions src/api/index.js
Expand Up @@ -2,7 +2,7 @@

'use strict';
const _ = require('lodash');
const core = require('./common').core;
const common = require('./common');
const server = require('./server/server');
const connect = server.connect;
const disconnect = server.disconnect;
Expand All @@ -28,11 +28,11 @@ const sign = require('./transaction/sign');
const submit = require('./transaction/submit');
const errors = require('./common').errors;
const convertExceptions = require('./common').convertExceptions;
const generateWallet = convertExceptions(core.Wallet.generate);
const generateWallet = convertExceptions(common.core.Wallet.generate);

function RippleAPI(options: {}) {
const _options = _.assign({}, options, {automatic_resubmission: false});
this.remote = new core.Remote(_options);
this.remote = new common.core.Remote(_options);
}

RippleAPI.prototype = {
Expand Down Expand Up @@ -65,4 +65,11 @@ RippleAPI.prototype = {
errors
};

// these are exposed only for use by unit tests; they are not part of the API
RippleAPI._PRIVATE = {
common: common,
ledgerUtils: require('./ledger/utils'),
schemaValidator: require('./common/schema-validator')
};

module.exports = RippleAPI;
13 changes: 6 additions & 7 deletions test/api-test.js
Expand Up @@ -4,21 +4,20 @@ const _ = require('lodash');
const assert = require('assert-diff');
const path = require('path');
const setupAPI = require('./setup-api');
const RippleAPI = require('../src').RippleAPI;
const RippleAPI = require('ripple-api').RippleAPI;
const common = RippleAPI._PRIVATE.common;
const fixtures = require('./fixtures/api');
const requests = fixtures.requests;
const responses = fixtures.responses;
const addresses = require('./fixtures/addresses');
const hashes = require('./fixtures/hashes');
const MockPRNG = require('./mock-prng');
const sjcl = require('../src/core').sjcl;
const sjcl = common.core.sjcl;
const address = addresses.ACCOUNT;
const common = require('../src/api/common');
const validate = common.validate;
const RippleError = require('../src/core/rippleerror').RippleError;
const utils = require('../src/api/ledger/utils');
const utils = RippleAPI._PRIVATE.ledgerUtils;
const ledgerClosed = require('./fixtures/api/rippled/ledger-close-newer');
const schemaValidator = require('../src/api/common/schema-validator');
const schemaValidator = RippleAPI._PRIVATE.schemaValidator;

const orderbook = {
base: {
Expand Down Expand Up @@ -394,7 +393,7 @@ describe('RippleAPI', function() {
return this.api.getTransactions(address, options).then(() => {
assert(false, 'Should throw RippleError');
}).catch(error => {
assert(error instanceof RippleError);
assert(error instanceof common.core.RippleError);
});
});

Expand Down
1 change: 1 addition & 0 deletions test/node_modules/ripple-api

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion test/setup-api.js
@@ -1,6 +1,6 @@
'use strict';
const net = require('net');
const RippleAPI = require('../src').RippleAPI;
const RippleAPI = require('ripple-api').RippleAPI;
const ledgerClosed = require('./fixtures/api/rippled/ledger-close');
const createMockRippled = require('./mock-rippled');

Expand Down

0 comments on commit 194b73c

Please sign in to comment.