I am trying to mock the behaviour from my transaction module in my account\_spec. I am finding it difficult. Once, I make a deposit from my account, I have to mock the behaviour for the transaction but I am finding it very hard. My test is currently returning `'Transaction' is not undefined`

EDIT:

I have an account module:

```
function Account(statement = new Statement, transaction = new Transaction){
  this._statement = statement
  this._transaction = transaction
}

Account.prototype.deposit = function(amount) {
  this._transaction.deposit(amount)
  this._statement.storeHistory(amount, this._balance, "Deposit")
}

Account.prototype.withdraw = function(amount) {
  this._transaction.withdraw(amount)
  this._statement.storeHistory(amount, this._balance, "Withdraw")
}

Account.prototype.balance = function() {
  return this._balance
}
module.exports = Account;

```

I have a transaction module:

```
function Transaction(){
    this._balance = 0
}

Transaction.prototype.balance = function() {
    return this.balance
}

Transaction.prototype.deposit = function(amount) {
    this._balance += amount
}

Transaction.prototype.withdraw = function(amount) {
    this._balance -= amount
}

module.exports = Transaction;

```

My Statement:

```
function Statement(){
  this._logs = []
}

Statement.prototype.seeStatement = function() {
  return this._logs
}

Statement.prototype.storeHistory = function(amount, balance, type) {
  this._logs.push({amount: amount, balance: balance, type: type})
}

module.exports = Statement;

```

My Account Spec:

```
'use strict';

describe('Account',function(){
  var account;
  beforeEach(function(){
    statement = new Statement
    var transactionSpy = jasmine.createSpyObj('transaction',['balance','withdraw','deposit']);
    account = new Account(statement, transactionSpy);
  });
  it('is able for a user to deposit', function(){
    account.deposit(40)
    // expect(account.balance()).toEqual(40)
  });
  it('is able for a user to withdraw', function() {
    account.deposit(40)
    account.withdraw(20)
    // expect(account.balance()).toEqual(20)
  });
  it('is able for a user to check their balance', function() {
    account.deposit(20)
    expect(transaction.balance()).toEqual(20)
  });
});

```