Skip to content

Commit b250ac6

Browse files
committed
moving-to-a-shared-object: add interestRate to AccountType
1 parent cb6b42e commit b250ac6

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
export class AccountType {
2-
constructor(nameString) {
2+
constructor(nameString, interestRate) {
33
this._name = nameString;
4+
this._interestRate = interestRate;
45
}
56

67
get name() {
78
return this._name;
89
}
10+
11+
get interestRate() {
12+
return this._interestRate;
13+
}
914
}

src/moving-to-a-shared-object/account-type/index.test.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@ import { AccountType } from '.';
22

33
describe('AccountType', () => {
44
it('should have a name', () => {
5-
const type = new AccountType('normal');
5+
const type = new AccountType('normal', 0.1);
66
expect(type.name).toEqual('normal');
77
});
8+
9+
it('should have an interestRate', () => {
10+
const type = new AccountType('normal', 0.1);
11+
expect(type.interestRate).toEqual(0.1);
12+
});
813
});

0 commit comments

Comments
 (0)