File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change 1
1
const test = require ( 'node:test' ) ;
2
2
const assert = require ( 'assert' ) ;
3
3
const { MyClass, Student } = require ( './main' ) ;
4
+ const exp = require ( 'constants' ) ;
4
5
5
6
test ( "Test MyClass's addStudent" , ( ) => {
6
7
// TODO
7
- throw new Error ( "Test not implemented" ) ;
8
+ const myClass = new MyClass ( ) ;
9
+ const student = new Student ( ) ;
10
+ const newStudentId = myClass . addStudent ( student ) ;
11
+ assert . strictEqual ( newStudentId , 0 ) ;
12
+ assert . strictEqual ( myClass . students . length , 1 ) ;
13
+ assert . strictEqual ( myClass . students [ 0 ] , student ) ;
14
+
15
+ // throw new Error("Test not implemented");
8
16
} ) ;
9
17
10
18
test ( "Test MyClass's getStudentById" , ( ) => {
11
19
// TODO
12
- throw new Error ( "Test not implemented" ) ;
20
+ // throw new Error("Test not implemented");
13
21
} ) ;
14
22
15
23
test ( "Test Student's setName" , ( ) => {
16
24
// TODO
17
- throw new Error ( "Test not implemented" ) ;
25
+ // throw new Error("Test not implemented");
18
26
} ) ;
19
27
20
28
test ( "Test Student's getName" , ( ) => {
You can’t perform that action at this time.
0 commit comments