Bank Tech test is a small project designed to practice code quality, test-driven development and process. It has been completed as a JavaScript implementation in Node.
I have also done an implementation in Ruby available here.
The application allows you to create an account, deposit funds into it, withdraw from it, and print statements that capture the account history and print to the screen.
- You should be able to interact with your code via a REPL like IRB or the JavaScript console. (You don't need to implement a command line interface that takes input from STDIN.)
- Deposits, withdrawal.
- Account statement (date, amount, balance) printing.
- Data can be kept in memory (it doesn't need to be stored to a database or anything).
Given a client makes a deposit of 1000 on 10-08-2020 And a deposit of 2000 on 13-08-2020 And a withdrawal of 500 on 14-08-2020 When she prints her bank statement Then she would see:
date || credit || debit || balance
14/08/2020 || || 500.00 || 2500.00
13/08/2020 || 2000.00 || || 3000.00
10/08/2020 || 1000.00 || || 1000.00
- Clone this repo
- Install dependencies with:
$ npm install
- Run tests with:
$ npm test
- Run the Node REPL:
$ node
- Require in
account.js
with:
> const Account = require('./src/account.js')
- Create new account with:
> let bankAccount = new Account();
- Use the account with the following functions:
Function | Description |
---|---|
bankAccount.add(amount); | Deposit any value you choose into the account as the amount parameter |
bankAccount.withdraw(amount); | Withdraw any value you choose from the account as the amount parameter. Although account must have at least that balance or 'Insuffient funds" will be shown |
bankAccount.statement(); | Will print statement to teh screen showing transaction history including dates, amounts and balance after each transaction |
Below is an example of what would be shown on the screen:
Production:
Moment - Time formatting library.
Development:
MockDate - A JavaScript mockdate object used to change when "now" is for testing purposes.
Jest - JavaScript testing framework.
Sinon - Standalone spies, stubs and mocks for JavaScript.