-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStatement.test.js
More file actions
26 lines (23 loc) · 1.26 KB
/
Copy pathStatement.test.js
File metadata and controls
26 lines (23 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
const Statement = require("./Statement");
describe('Statement', () =>{
it("creates a header variable with required format date || credit || debit || balance", () => {
const statement = new Statement();
expect(statement.header).toStrictEqual('date || credit || debit || balance')
})
it("when there are no transactions prints an empty statement", () => {
const transactions = []
const statement = new Statement(transactions);
expect(statement.print()).toStrictEqual('date || credit || debit || balance')
})
it("when there are no transactions prints an empty statement", () => {
const mockDeposit1 = { format: ()=> '10/01/2023 || 1000.00 || || 1000.00' }
const mockDeposit2 = { format: ()=> '13/01/2023 || 2000.00 || || 3000.00' }
const mockWithdrawal1 = { format: ()=> '14/01/2023 || || 500.00 || 2500.00' }
const transactions = [mockDeposit1, mockDeposit2, mockWithdrawal1]
const statement = new Statement(transactions);
expect(statement.print()).toStrictEqual(`date || credit || debit || balance\n`+
`14/01/2023 || || 500.00 || 2500.00\n`+
`13/01/2023 || 2000.00 || || 3000.00\n`+
`10/01/2023 || 1000.00 || || 1000.00`)
})
})