@@ -3,43 +3,35 @@ const assert = require('assert');
3
3
const { MyClass, Student } = require ( './main' ) ;
4
4
5
5
test ( "Test MyClass's addStudent" , ( ) => {
6
- // TODO
7
6
const myClass = new MyClass ( ) ;
8
7
const student = new Student ( ) ;
9
8
student . setName ( 'John' ) ;
10
9
assert . strictEqual ( myClass . addStudent ( student ) , 0 ) ;
11
10
assert . strictEqual ( myClass . addStudent ( 123 ) , - 1 ) ;
12
- // throw new Error("Test not implemented");
13
11
} ) ;
14
12
15
13
test ( "Test MyClass's getStudentById" , ( ) => {
16
- // TODO
17
14
const myClass = new MyClass ( ) ;
18
15
const student = new Student ( ) ;
19
16
student . setName ( 'John' ) ;
20
17
const newStudentId = myClass . addStudent ( student ) ;
21
18
assert . strictEqual ( myClass . getStudentById ( newStudentId ) , student ) ;
22
19
assert . strictEqual ( myClass . getStudentById ( - 2 ) , null ) ;
23
20
assert . strictEqual ( myClass . getStudentById ( 2 ) , null ) ;
24
- // throw new Error("Test not implemented");
25
21
} ) ;
26
22
27
23
test ( "Test Student's setName" , ( ) => {
28
- // TODO
29
24
const myClass = new MyClass ( ) ;
30
25
const student = new Student ( ) ;
31
26
student . setName ( 'John' ) ;
32
27
assert . strictEqual ( student . name , 'John' ) ;
33
28
student . setName ( 123 ) ;
34
- // throw new Error("Test not implemented");
35
29
} ) ;
36
30
37
31
test ( "Test Student's getName" , ( ) => {
38
- // TODO
39
32
const myClass = new MyClass ( ) ;
40
33
const student = new Student ( ) ;
41
34
assert . strictEqual ( student . getName ( ) , '' ) ;
42
35
student . setName ( 'John' ) ;
43
36
assert . strictEqual ( student . getName ( ) , 'John' ) ;
44
- // throw new Error("Test not implemented");
45
37
} ) ;
0 commit comments