Add a test for Trader API

This commit is contained in:
Maciej Małecki 2014-04-15 11:06:09 +02:00
parent 0666762051
commit 8ccf5bbf9e

View file

@ -0,0 +1,29 @@
'use strict';
var assert = require('chai').assert;
var Trader = require('../../lib/trader.js');
var PostgresqlInterface = require('../../lib/protocol/db/postgresql_interface.js');
var db = 'psql://lamassu:lamassu@localhost/lamassu-test';
var psqlInterface = new PostgresqlInterface(db);
describe('trader/api', function () {
it('should throw when trying to create a trader with no DB', function () {
assert.throws(function () {
new Trader();
});
});
it('should throw when trying to configure a trader with `lowBalanceMargin` < 1', function () {
var trader = new Trader(psqlInterface);
assert.throws(function () {
trader.configure({
exchanges: {
settings: {
lowBalanceMargin: 0.8
}
}
});
});
});
});