<commit_before>require 'helper'

class TestMt940Rabobank < Test::Unit::TestCase

  def setup
    @file_name = File.dirname(__FILE__) + '/fixtures/rabobank.txt'
    @transactions = MT940::Base.transactions(@file_name)
    @transaction = @transactions.first
  end

  should 'have the correct number of transactions' do
    assert_equal 3, @transactions.size
  end

  context 'Transaction' do
    should 'get the opening balance and date' do
      @info = MT940::Base.transactions_with_info(@file_name)

      assert_equal 473.17, @info.opening_balance
      assert_equal Date.new(2011, 6, 14), @info.opening_date
    end

    should 'get the debet opening balance and date' do
      @info = MT940::Base.transactions_with_info(File.dirname(__FILE__) + '/fixtures/rabobank_with_debet_opening_balance.txt')

      assert_equal -12, @info.opening_balance
      assert_equal Date.new(2012, 10, 4), @info.opening_date
    end

    should 'have a bank_account' do
      assert_equal '129199348', @transaction.bank_account
    end

    context 'Contra account' do
      should 'be determined in case of a GIRO account' do
        assert_equal '121470966', @transaction.contra_account
      end
<commit_msg>Test for empty mt940 file.<commit_after>require 'helper'

class TestMt940Rabobank < Test::Unit::TestCase

  def setup
    @file_name = File.dirname(__FILE__) + '/fixtures/rabobank.txt'
    @transactions = MT940::Base.transactions(@file_name)
    @transaction = @transactions.first
  end

  should 'have the correct number of transactions' do
    assert_equal 3, @transactions.size
  end

  context 'Transaction' do
    should 'get the opening balance and date' do
      @info = MT940::Base.transactions_with_info(@file_name)

      assert_equal 473.17, @info.opening_balance
      assert_equal Date.new(2011, 6, 14), @info.opening_date
    end

    should 'get the debet opening balance and date' do
      @info = MT940::Base.transactions_with_info(File.dirname(__FILE__) + '/fixtures/rabobank_with_debet_opening_balance.txt')

      assert_equal -12, @info.opening_balance
      assert_equal Date.new(2012, 10, 4), @info.opening_date
      assert_not_nil @info.transactions
    end

    should 'have a bank_account' do
      assert_equal '129199348', @transaction.bank_account
    end

    context 'Contra account' do
      should 'be determined in case of a GIRO account' do
        assert_equal '121470966', @transaction.contra_account
      end

{'fraction_non_alphanumeric': 0.08957055214723926, 'fraction_numerical': 0.04376278118609407, 'mean_word_length': 3.6948176583493284, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '746701', 'n_tokens_mistral': 852, 'n_tokens_neox': 749, 'n_words': 200}