From 243e7955cb79fab8d6d6ce467dae78cdbc2286a5 Mon Sep 17 00:00:00 2001 From: Kuan-Wei Chiu Date: Fri, 1 Mar 2024 22:33:55 +0800 Subject: [PATCH] test: add MyClass's getStudentById test --- lab1/main_test.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lab1/main_test.js b/lab1/main_test.js index b48eda6b..7ba38ad8 100644 --- a/lab1/main_test.js +++ b/lab1/main_test.js @@ -10,7 +10,11 @@ test("Test MyClass's addStudent", () => { }); test("Test MyClass's getStudentById", () => { - + let class1 = new MyClass(); + let student = new Student(); + class1.addStudent(student); + assert.strictEqual(class1.getStudentById(-1), null); + assert.strictEqual(class1.getStudentById(0), student); }); test("Test Student's setName", () => {