File tree 2 files changed +4
-10
lines changed
src/functions-into-class-hierarchy/bird
2 files changed +4
-10
lines changed Original file line number Diff line number Diff line change @@ -6,9 +6,8 @@ export class Bird {
6
6
get plumage ( ) {
7
7
switch ( this . type ) {
8
8
case 'EuropeanSwallow' :
9
- throw 'oops' ;
10
9
case 'AfricanSwallow' :
11
- return this . numberOfCoconuts > 2 ? 'tired' : 'average ';
10
+ throw 'oops ';
12
11
case 'NorwegianBlueParrot' :
13
12
return this . voltage > 100 ? 'scorched' : 'beautiful' ;
14
13
default :
Original file line number Diff line number Diff line change @@ -7,14 +7,9 @@ describe('Bird', () => {
7
7
expect ( ( ) => bird . plumage ) . toThrow ( 'oops' ) ;
8
8
} ) ;
9
9
10
- it ( 'should return "tired" for AfricanSwallow with more than 2 coconuts' , ( ) => {
11
- const bird = new Bird ( { type : 'AfricanSwallow' , numberOfCoconuts : 3 } ) ;
12
- expect ( bird . plumage ) . toBe ( 'tired' ) ;
13
- } ) ;
14
-
15
- it ( 'should return "average" for AfricanSwallow with 2 or less coconuts' , ( ) => {
16
- const bird = new Bird ( { type : 'AfricanSwallow' , numberOfCoconuts : 2 } ) ;
17
- expect ( bird . plumage ) . toBe ( 'average' ) ;
10
+ it ( 'should throw an error if bird type is AfricanSwallow' , ( ) => {
11
+ const bird = new Bird ( { type : 'AfricanSwallow' } ) ;
12
+ expect ( ( ) => bird . plumage ) . toThrow ( 'oops' ) ;
18
13
} ) ;
19
14
20
15
it ( 'should return "scorched" for NorwegianBlueParrot with voltage greater than 100' , ( ) => {
You can’t perform that action at this time.
0 commit comments