File tree 2 files changed +1
-10
lines changed 2 files changed +1
-10
lines changed Original file line number Diff line number Diff line change @@ -17,16 +17,12 @@ export class Employee {
17
17
return this . _type . toString ( ) ;
18
18
}
19
19
20
- get capitalizedType ( ) {
21
- return this . typeString . charAt ( 0 ) . toUpperCase ( ) + this . typeString . substr ( 1 ) . toLowerCase ( ) ;
22
- }
23
-
24
20
validateType ( arg ) {
25
21
if ( ! [ `engineer` , `manager` , `salesman` ] . includes ( arg ) )
26
22
throw new Error ( `Employee cannot be of type ${ arg } ` ) ;
27
23
}
28
24
29
25
toString ( ) {
30
- return `${ this . _name } (${ this . capitalizedType } )` ;
26
+ return `${ this . _name } (${ this . type . capitalizedName } )` ;
31
27
}
32
28
}
Original file line number Diff line number Diff line change @@ -6,11 +6,6 @@ describe('Employee', () => {
6
6
expect ( ( ) => new Employee ( 'Kaio' , 'invalid' ) ) . toThrow ( 'Employee cannot be of type invalid' ) ;
7
7
} ) ;
8
8
9
- it ( 'should return the capitalized type' , ( ) => {
10
- const employee = new Employee ( 'Kaio' , new EmployeeType ( 'engineer' ) ) ;
11
- expect ( employee . capitalizedType ) . toBe ( 'Engineer' ) ;
12
- } ) ;
13
-
14
9
describe ( 'toString' , ( ) => {
15
10
it ( 'should return the name and type' , ( ) => {
16
11
const employee = new Employee ( 'Kaio' , new EmployeeType ( 'engineer' ) ) ;
You can’t perform that action at this time.
0 commit comments