@@ -3,43 +3,35 @@ const assert = require('assert');
33const { MyClass, Student } = require ( './main' ) ;
44
55test ( "Test MyClass's addStudent" , ( ) => {
6- // TODO
76 const myClass = new MyClass ( ) ;
87 const student = new Student ( ) ;
98 student . setName ( 'John' ) ;
109 assert . strictEqual ( myClass . addStudent ( student ) , 0 ) ;
1110 assert . strictEqual ( myClass . addStudent ( 123 ) , - 1 ) ;
12- // throw new Error("Test not implemented");
1311} ) ;
1412
1513test ( "Test MyClass's getStudentById" , ( ) => {
16- // TODO
1714 const myClass = new MyClass ( ) ;
1815 const student = new Student ( ) ;
1916 student . setName ( 'John' ) ;
2017 const newStudentId = myClass . addStudent ( student ) ;
2118 assert . strictEqual ( myClass . getStudentById ( newStudentId ) , student ) ;
2219 assert . strictEqual ( myClass . getStudentById ( - 2 ) , null ) ;
2320 assert . strictEqual ( myClass . getStudentById ( 2 ) , null ) ;
24- // throw new Error("Test not implemented");
2521} ) ;
2622
2723test ( "Test Student's setName" , ( ) => {
28- // TODO
2924 const myClass = new MyClass ( ) ;
3025 const student = new Student ( ) ;
3126 student . setName ( 'John' ) ;
3227 assert . strictEqual ( student . name , 'John' ) ;
3328 student . setName ( 123 ) ;
34- // throw new Error("Test not implemented");
3529} ) ;
3630
3731test ( "Test Student's getName" , ( ) => {
38- // TODO
3932 const myClass = new MyClass ( ) ;
4033 const student = new Student ( ) ;
4134 assert . strictEqual ( student . getName ( ) , '' ) ;
4235 student . setName ( 'John' ) ;
4336 assert . strictEqual ( student . getName ( ) , 'John' ) ;
44- // throw new Error("Test not implemented");
4537} ) ;
0 commit comments