-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtransaction.test.js
61 lines (44 loc) · 1.5 KB
/
transaction.test.js
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
const Transaction = require('./transaction');
describe('Transaction', () => {
it('displays the current date', () => {
let transaction = new Transaction('deposit', 1000, 1000)
console.log(transaction.date)
expect(transaction.date).toEqual(transaction.formatDate())
})
describe('deposit transaction', () => {
let transaction;
beforeEach(() => {
transaction = new Transaction('deposit', 1000, 1000, '22/06/2022')
})
it('records the type of the transaction', () => {
expect(transaction.type).toBe('deposit')
})
it('records the amount of the transaction', () => {
expect(transaction.amount).toBe(1000)
})
it('records the balance of the transaction', () => {
expect(transaction.balance).toBe(1000)
})
it('records the date of the transaction', () => {
expect(transaction.date).toBe('22/06/2022')
})
})
describe('withdraw transaction', () => {
let transaction;
beforeEach(() => {
transaction = new Transaction('withdraw', 500, 2000, '23/06/2022')
})
it('records the type of the transaction', () => {
expect(transaction.type).toBe('withdraw')
})
it('records the amount of the transaction', () => {
expect(transaction.amount).toBe(500)
})
it('records the balance of the transaction', () => {
expect(transaction.balance).toBe(2000)
})
it('records the date of the transaction', () => {
expect(transaction.date).toBe('23/06/2022')
})
})
})