Skip to content

Commit 81bfbaa

Browse files
committed
ex-02: implement airSpeedVelocity at AffricanSwallowDelegate
1 parent a4d9600 commit 81bfbaa

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/example-02/birds/affrican-swallow/delegate/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,8 @@ export class AffricanSwallowDelegate {
22
constructor(data) {
33
this._numberOfCoconuts = data.numberOfCoconuts;
44
}
5+
6+
get airSpeedVelocity() {
7+
return 40 - 2 * this._numberOfCoconuts;
8+
}
59
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { AffricanSwallowDelegate } from '.';
2+
3+
describe('AffricanSwallowDelegate', () => {
4+
describe('airSpeedVelocity', () => {
5+
it('should have airSpeedVelocity 38 if number of coconuts is 1', () => {
6+
const bird = new AffricanSwallowDelegate({ type: 'AffricanSwallow', numberOfCoconuts: 1 });
7+
expect(bird.airSpeedVelocity).toBe(38);
8+
});
9+
});
10+
});

0 commit comments

Comments
 (0)