Skip to content

Commit 4e5eb11

Browse files
committed
Merge branch 'beta'
2 parents 7e68d03 + 199be51 commit 4e5eb11

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+2383
-2394
lines changed

.eslintrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
"react/no-unused-prop-types": 0,
4646
"no-underscore-dangle": 0,
4747
"max-len": 0,
48+
"semi": 0,
4849
},
4950
"settings": {
5051
"import/ignore": \.(scss|less|css)$,

src/botPage/bot/__tests__/index.js

Lines changed: 84 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import CustomApi from 'binary-common-utils/lib/customApi';
1+
import CustomApi from 'binary-common-utils/lib/customApi'
22
import { expect } from 'chai'; // eslint-disable-line import/no-extraneous-dependencies
3-
import { observer } from 'binary-common-utils/lib/observer';
4-
import Bot from '../';
5-
import mockWebsocket from '../../../common/mock/websocket';
3+
import { observer } from 'binary-common-utils/lib/observer'
4+
import Bot from '../'
5+
import mockWebsocket from '../../../common/mock/websocket'
66

77
describe('Bot', () => {
88
const option = {
@@ -14,122 +14,122 @@ describe('Bot', () => {
1414
duration: 5,
1515
duration_unit: 't',
1616
symbol: 'R_100',
17-
};
17+
}
1818

19-
let api;
20-
let bot;
21-
const token = 'nmjKBPWxM00E8Fh';
19+
let api
20+
let bot
21+
const token = 'nmjKBPWxM00E8Fh'
2222
before(function beforeAll(done) { // eslint-disable-line prefer-arrow-callback
23-
observer.eventActionMap = {};
24-
api = new CustomApi(mockWebsocket);
25-
bot = new Bot(api);
23+
observer.eventActionMap = {}
24+
api = new CustomApi(mockWebsocket)
25+
bot = new Bot(api)
2626
bot.initPromise.then(() => {
27-
done();
28-
});
29-
});
27+
done()
28+
})
29+
})
3030
it('initialize bot with the symbols', () => {
31-
const markets = bot.symbol.activeSymbols.getMarkets();
31+
const markets = bot.symbol.activeSymbols.getMarkets()
3232
expect(markets).to.be.an('Object')
33-
.and.to.have.property('forex');
34-
});
33+
.and.to.have.property('forex')
34+
})
3535
describe('Bot cannot start with a fake token', () => {
36-
let error;
36+
let error
3737
before(function beforeAll(done) { // eslint-disable-line prefer-arrow-callback
3838
observer.register('api.error', (_error) => {
39-
error = _error;
40-
done();
41-
}, true);
42-
bot.start('FakeToken', null, null, null, null);
43-
});
39+
error = _error
40+
done()
41+
}, true)
42+
bot.start('FakeToken', null, null, null, null)
43+
})
4444
it('fake token should cause an error', () => {
4545
expect(error).to.have.deep.property('.error.code')
46-
.that.is.equal('InvalidToken');
47-
});
48-
});
46+
.that.is.equal('InvalidToken')
47+
})
48+
})
4949
describe('Start trading', () => {
5050
before(function beforeAll(done) { // eslint-disable-line prefer-arrow-callback
5151
observer.register('bot.waiting_for_purchase', () => {
52-
done();
53-
}, true);
52+
done()
53+
}, true)
5454
observer.register('bot.stop', () => {
55-
bot.start(token, option, () => {}, () => {}, () => {});
56-
}, true);
57-
bot.stop();
58-
});
59-
it('start bot with the token, option', () => {});
60-
});
55+
bot.start(token, option, () => {}, () => {}, () => {})
56+
}, true)
57+
bot.stop()
58+
})
59+
it('start bot with the token, option', () => {})
60+
})
6161
describe('Start the trade without real after purchase and before purchase functions', () => {
6262
before(function beforeAll(done) { // eslint-disable-line prefer-arrow-callback
6363
observer.register('bot.stop', () => {
6464
bot.initPromise.then(() => {
6565
observer.register('bot.waiting_for_purchase', () => {
66-
done();
67-
}, true);
68-
bot.start(token, option, () => {}, () => {}, () => {});
69-
});
70-
}, true);
71-
bot.stop();
72-
});
73-
it('It is possible to restart the trade', () => {});
74-
});
66+
done()
67+
}, true)
68+
bot.start(token, option, () => {}, () => {}, () => {})
69+
})
70+
}, true)
71+
bot.stop()
72+
})
73+
it('It is possible to restart the trade', () => {})
74+
})
7575
describe('Start the trade with real after purchase and before purchase functions', () => {
76-
let finishedContractFromFinishFunction;
77-
let finishedContractFromFinishSignal;
78-
let numOfTicks = 0;
76+
let finishedContractFromFinishFunction
77+
let finishedContractFromFinishSignal
78+
let numOfTicks = 0
7979
before(function beforeAll(done) { // eslint-disable-line prefer-arrow-callback
80-
this.timeout('20000');
80+
this.timeout('20000')
8181
observer.register('bot.stop', () => {
8282
bot.initPromise.then(() => {
8383
observer.register('bot.finish', (_finishedContractFromFinishSignal) => {
84-
finishedContractFromFinishSignal = _finishedContractFromFinishSignal;
85-
done();
86-
}, true);
84+
finishedContractFromFinishSignal = _finishedContractFromFinishSignal
85+
done()
86+
}, true)
8787
bot.start(token, option, (tick, proposals, _purchaseCtrl) => {
88-
if (!_purchaseCtrl) return;
88+
if (!_purchaseCtrl) return
8989
if (++numOfTicks === 3) {
90-
_purchaseCtrl.purchase('DIGITEVEN');
90+
_purchaseCtrl.purchase('DIGITEVEN')
9191
}
9292
}, () => {}, (_finishedContract) => {
93-
finishedContractFromFinishFunction = _finishedContract;
94-
});
95-
});
96-
}, true);
97-
bot.stop();
98-
});
99-
it('Before Purchase decides to purchase the trade', () => {});
93+
finishedContractFromFinishFunction = _finishedContract
94+
})
95+
})
96+
}, true)
97+
bot.stop()
98+
})
99+
it('Before Purchase decides to purchase the trade', () => {})
100100
it('Calls the after purchase function when trade is finished', () => {
101-
expect(finishedContractFromFinishSignal).to.be.equal(finishedContractFromFinishFunction);
102-
});
103-
});
101+
expect(finishedContractFromFinishSignal).to.be.equal(finishedContractFromFinishFunction)
102+
})
103+
})
104104
describe('Trade again', () => {
105-
let finishedContractFromFinishFunction;
106-
let finishedContractFromFinishSignal;
107-
let numOfTicks = 0;
105+
let finishedContractFromFinishFunction
106+
let finishedContractFromFinishSignal
107+
let numOfTicks = 0
108108
before(function beforeAll(done) { // eslint-disable-line prefer-arrow-callback
109109
bot.start(token, option, (tick, proposals, _purchaseCtrl) => {
110110
if (++numOfTicks === 3) {
111-
_purchaseCtrl.purchase('DIGITEVEN');
111+
_purchaseCtrl.purchase('DIGITEVEN')
112112
}
113113
}, () => {}, (_finishedContract) => {
114-
finishedContractFromFinishFunction = _finishedContract;
115-
});
114+
finishedContractFromFinishFunction = _finishedContract
115+
})
116116
observer.register('bot.stop', (_finishedContractFromFinishSignal) => {
117-
finishedContractFromFinishSignal = _finishedContractFromFinishSignal;
118-
done();
119-
}, true);
120-
bot.stop();
121-
});
122-
it('Before Purchase decides to purchase the trade', () => {});
117+
finishedContractFromFinishSignal = _finishedContractFromFinishSignal
118+
done()
119+
}, true)
120+
bot.stop()
121+
})
122+
it('Before Purchase decides to purchase the trade', () => {})
123123
it('Calls the after purchase function when trade is finished', () => {
124-
expect(finishedContractFromFinishSignal).to.be.equal(finishedContractFromFinishFunction);
125-
});
126-
});
124+
expect(finishedContractFromFinishSignal).to.be.equal(finishedContractFromFinishFunction)
125+
})
126+
})
127127
after(function afterAll(done) { // eslint-disable-line prefer-arrow-callback
128128
observer.register('bot.stop', () => {
129-
observer.destroy();
130-
api.destroy();
131-
done();
132-
});
133-
bot.stop();
134-
});
135-
});
129+
observer.destroy()
130+
api.destroy()
131+
done()
132+
})
133+
bot.stop()
134+
})
135+
})

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy