Skip to content

Commit

Permalink
Add account creation hooks to bank transaction testing
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbanham committed Mar 8, 2017
1 parent f0ab37b commit 5771b5c
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion test/accountingtests.js
Expand Up @@ -669,6 +669,35 @@ describe('regression tests', function() {

var sharedTransaction;

var testAccountId;
var testAccount;

before('create a bank account', function() {
const randomString = uuid.v4();

var testAccountData = {
Code: randomString.replace(/-/g,'').substring(0, 10),
Name: 'Test account from Node SDK ' + randomString,
Type: 'BANK',
BankAccountNumber: '062-021-0000000',
};

var account = currentApp.core.accounts.newAccount(testAccountData);

return account.save()
.then(function(response) {
var account = response.entities[0];
testAccount = account;
testAccountId = account.AccountID;
});
});

// There appears to be no way to archive a bank account via the API
// after('archive the test account', function() {
// testAccount.Status = 'ARCHIVED';
// return testAccount.save();
// });

it('creates a new transaction', function(done) {
var transaction = currentApp.core.bankTransactions.newBankTransaction({
Type: "SPEND",
Expand All @@ -681,7 +710,7 @@ describe('regression tests', function() {
AccountCode: '404'
}],
BankAccount: {
AccountID: "13918178-849A-4823-9A31-57B7EAC713D7"
AccountID: testAccountId
}
});

Expand Down

0 comments on commit 5771b5c

Please sign in to comment.