<commit_before>BD = require('bigdecimal')

Q = require("q")

operations = require('../lib/operations')

ProcessingChainEntrance = require('../lib/processingchainentrance')
TradeEngine = require('../lib/trade_engine')
Journal = require('../lib/journal')

describe 'TradeEngine', ->
  beforeEach =>
    TestHelper.clean_state_sync

  afterEach =>
    TestHelper.clean_state_sync

  it 'can perform deposit', (finish) ->
    deferred = Q.defer()
    deferred.resolve(undefined)

    replicationStub =
      start: sinon.stub()
      send: sinon.stub().returns(deferred.promise)

    pce = new ProcessingChainEntrance(new TradeEngine(),
                                      new Journal(),
                                      replicationStub)
    pce.start().then ->
      pce.forward_message({
        kind: operations.ADD_DEPOSIT
        operatation:
          account: 'Peter'
          password: '<PASSWORD>'
          currency: 'USD'
          amount: 200.0
      })
      finish()
<commit_msg>should be finish<commit_after>BD = require('bigdecimal')
Q = require("q")

logger = require('../lib/logger')

operations = require('../lib/operations')
ProcessingChainEntrance = require('../lib/processingchainentrance')
TradeEngine = require('../lib/trade_engine')
Journal = require('../lib/journal')

describe 'TradeEngine', ->
  beforeEach =>
    TestHelper.clean_state_sync

  afterEach =>
    TestHelper.clean_state_sync

  it 'can perform deposit', (finish) ->
    deferred = Q.defer()
    deferred.resolve(undefined)

    replicationStub =
      start: sinon.stub()
      send: sinon.stub().returns(deferred.promise)

    pce = new ProcessingChainEntrance(new TradeEngine(),
                                      new Journal(),
                                      replicationStub)
    pce.start().then ->
      logger.info('Started PCE')
      pce.forward_message({
        kind: operations.ADD_DEPOSIT
        operatation:
          account: 'Peter'
          password: '<PASSWORD>'
          currency: 'USD'
          amount: 200.0
      })
      finish()
    .done()
{'fraction_non_alphanumeric': 0.12873674059787849, 'fraction_numerical': 0.003857280617164899, 'mean_word_length': 2.2988871224165344, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3588954', 'n_tokens_mistral': 613, 'n_tokens_neox': 590, 'n_words': 111}