Add a test for Trader API
This commit is contained in:
parent
0666762051
commit
8ccf5bbf9e
1 changed files with 29 additions and 0 deletions
29
test/unit/traderApiTest.js
Normal file
29
test/unit/traderApiTest.js
Normal 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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
Loading…
Add table
Add a link
Reference in a new issue