<commit_before>'use strict'

// ----------------------------------------------------------------------------

const assert = require ('assert')
    , chai = require ('chai')
    , expect = chai.expect

// ----------------------------------------------------------------------------

module.exports = (exchange, item, code, now) => {
    expect (item).to.be.an ('object')
    assert ('id' in item)
    assert (item['id'] === undefined || typeof item['id'] === 'string')
    assert ('direction' in item)
    assert (item['direction'] === 'in' || item['direction'] === 'out')
    assert ('account' in item)
    assert (item['account'] === undefined || typeof item['account'] === 'string')
    assert ('referenceId' in item)
    assert (item['referenceId'] === undefined || typeof item['referenceId'] === 'string')
    assert ('referenceAccount' in item)
    assert (item['referenceAccount'] === undefined || typeof item['referenceAccount'] === 'string')
    assert ('type' in item)
    // expect (item.type).to.be.oneOf (['trade', 'transaction', 'margin', 'cashback', 'referral', 'transfer', 'fee', /* TODO: add more types here */ ])
    assert ('currency' in item)
    assert (item['currency'] in exchange.currecies)
    assert ('amount' in item)
    expect (typeof item.amount).to.be.oneOf (['number', 'undefined'])
    assert ('before' in item)
    expect (typeof item.balanceBefore).to.be.oneOf (['number', 'undefined'])
    assert ('after' in item)
    expect (typeof item.balanceAfter).to.be.oneOf (['number', 'undefined'])
    assert ('timestamp' in item)
    expect (typeof item.timestamp).to.be.oneOf (['number', 'undefined'])<commit_msg>test.ledgerItem cleanup<commit_after>'use strict'

// ----------------------------------------------------------------------------

const assert = require ('assert')
    , chai = require ('chai')
    , expect = chai.expect

// ----------------------------------------------------------------------------

module.exports = (exchange, item, code, now) => {
    assert (typeof item === 'object')
    assert ('id' in item)
    assert (item['id'] === undefined || typeof item['id'] === 'string')
    assert ('direction' in item)
    assert (item['direction'] === 'in' || item['direction'] === 'out')
    assert ('account' in item)
    assert (item['account'] === undefined || typeof item['account'] === 'string')
    assert ('referenceId' in item)
    assert (item['referenceId'] === undefined || typeof item['referenceId'] === 'string')
    assert ('referenceAccount' in item)
    assert (item['referenceAccount'] === undefined || typeof item['referenceAccount'] === 'string')
    assert ('type' in item)
    // expect (item.type).to.be.oneOf (['trade', 'transaction', 'margin', 'cashback', 'referral', 'transfer', 'fee', /* TODO: add more types here */ ])
    assert ('currency' in item)
    assert (item['currency'] in exchange.currecies)
    assert ('amount' in item)
    expect (typeof item.amount).to.be.oneOf (['number', 'undefined'])
    assert ('before' in item)
    expect (typeof item.balanceBefore).to.be.oneOf (['number', 'undefined'])
    assert ('after' in item)
    expect (typeof item.balanceAfter).to.be.oneOf (['number', 'undefined'])
    assert ('timestamp' in item)
    expect (typeof item.timestamp).to.be.oneOf (['number', 'undefined'])
{'fraction_non_alphanumeric': 0.2695573074590661, 'fraction_numerical': 0.0, 'mean_word_length': 2.6574279379157426, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5507387', 'n_tokens_mistral': 886, 'n_tokens_neox': 879, 'n_words': 261}