<commit_before>'use strict';

var app = require('../../server/app');

var chai = require('chai');
var expect = chai.expect;

var User = require('../../server/api/user/user.model');
var BankAccount = require('../../server/api/bankaccount/bankaccount.model');
var Wallet = require('../../server/api/wallet/wallet.model');

var TestingUtils = require('../utils/testing_utils');

var CreateWallet = require('../../server/api/create_wallet/create_wallet.socket');

var Utils = require('./../../server/utils/utils');

var debug = require('debug')('CreateWalletForUserSpec');

describe('ITest signup', function () {

  beforeEach(function(done){
    this.timeout(10000);
    TestingUtils.dropMongodbDatabase().then(function(){

      //ugly hack for an integration test but hope it works
      CreateWallet.register(TestingUtils.buildSocketSpy());

      debug('dropMongodbDatabase');
      // TestingUtils.buildClientSocketIoConnection();
      debug('buildClientSocketIoConnection');
      done();
    });
  });

  it('should create an wallet for the user', function (done) {
    this.timeout(10000);
    //TODO: should first send rippled credits to the bank (create bank wallet)
    debug('should create an wallet1');
    TestingUtils.seedBankAndUser(function(theUser){
      debug('should create an wallet2');
      CreateWallet.createWalletForEmail(theUser.email).then(function() {
        debug('should create an wallet3');
        Wallet.findByOwnerEmail(theUser.email).then(function(wallet){
          debug('should create an wallet4');
          expect(wallet.ownerEmail).to.eql('<EMAIL>');

          debug('should create an wallet5');
          Utils.getNewConnectedRemote().then(function(remote){
            debug('should create an wallet6');

            var options = {
              account: wallet.address,
              ledger: 'validated'
            };

            debug('remote.requestAccountInfo', options);
            remote.requestAccountInfo(options, function(err, info) {
              debug('should create an wallet7');
              expect(err).to.eql(null);
              expect(info).to.have.deep.property('account_data.Account', wallet.address);
              expect(info).to.have.deep.property('account_data.Balance', '60000000');
              done();
            })
          })
        })
      }).done(null, function (error) {done(error);});
    });
  });


});
<commit_msg>better debug messages<commit_after>'use strict';

var app = require('../../server/app');

var chai = require('chai');
var expect = chai.expect;

var User = require('../../server/api/user/user.model');
var BankAccount = require('../../server/api/bankaccount/bankaccount.model');
var Wallet = require('../../server/api/wallet/wallet.model');

var TestingUtils = require('../utils/testing_utils');

var CreateWallet = require('../../server/api/create_wallet/create_wallet.socket');

var Utils = require('./../../server/utils/utils');

var debug = require('debug')('CreateWalletForUserSpec');

describe('ITest signup', function () {

  beforeEach(function(done){
    this.timeout(10000);
    TestingUtils.dropMongodbDatabase().then(function(){

      //ugly hack for an integration test but hope it works
      CreateWallet.register(TestingUtils.buildSocketSpy());

      debug('dropMongodbDatabase');
      // TestingUtils.buildClientSocketIoConnection();
      debug('buildClientSocketIoConnection');
      done();
    });
  });

  it('should create an wallet for the user', function (done) {
    this.timeout(10000);
    //TODO: should first send rippled credits to the bank (create bank wallet)
    debug('should create a wallet');
    //CreateWallet.fundWallet(bank.hotWallet, Utils.ROOT_RIPPLE_ACCOUNT).then(function () {
    TestingUtils.seedBankAndUser(function(theUser){
      debug('seedBankAndUser');
      CreateWallet.createWalletForEmail(theUser.email).then(function() {
        debug('createWalletForEmail');
        Wallet.findByOwnerEmail(theUser.email).then(function(wallet){
          debug('findByOwnerEmail');
          expect(wallet.ownerEmail).to.eql('<EMAIL>');

          debug('call getNewConnectedRemote');
          Utils.getNewConnectedRemote().then(function(remote){
            debug('getNewConnectedRemote');

            var options = {
              account: wallet.address,
              ledger: 'validated'
            };

            debug('remote.requestAccountInfo', options);
            remote.requestAccountInfo(options, function(err, info) {
              debug('requestAccountInfo');
              expect(err).to.eql(null);
              expect(info).to.have.deep.property('account_data.Account', wallet.address);
              expect(info).to.have.deep.property('account_data.Balance', '60000000');
              done();
            })
          })
        })
      }).done(null, function (error) {done(error);});
    });
  });


});

{'fraction_non_alphanumeric': 0.15471311475409835, 'fraction_numerical': 0.008811475409836065, 'mean_word_length': 2.9682926829268292, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, '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': '4256506', 'n_tokens_mistral': 1378, 'n_tokens_neox': 1344, 'n_words': 245}