From 92ad692b26bfa7de98deae9ecd52544001cc0242 Mon Sep 17 00:00:00 2001 From: 108062204 Date: Thu, 29 Feb 2024 19:12:23 +0800 Subject: [PATCH] first try --- lab1/main_test.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/lab1/main_test.js b/lab1/main_test.js index 74a716b4..1cb3db74 100644 --- a/lab1/main_test.js +++ b/lab1/main_test.js @@ -4,20 +4,41 @@ const { MyClass, Student } = require('./main'); test("Test MyClass's addStudent", () => { // TODO + const myClass = new MyClass(); + const student = new Student(); + const name="Daniel"; + student.setName(name); + assert.strictEqual(myClass.addStudent(student),1); throw new Error("Test not implemented"); }); test("Test MyClass's getStudentById", () => { // TODO + const myClass = new MyClass(); + const student = new Student(); + const name="Daniel"; + student.setName(name); + const newStudentId=myClass.addStudent(student); + assert.strictEqual(myClass.getStudentById(newStudentId).getName(),"Daniel"); throw new Error("Test not implemented"); }); test("Test Student's setName", () => { // TODO + const myClass = new MyClass(); + const student = new Student(); + const name="Daniel"; + student.setName(name); + assert.strictEqual(student.name,"Daniel"); throw new Error("Test not implemented"); }); test("Test Student's getName", () => { // TODO + const myClass = new MyClass(); + const student = new Student(); + const name="Daniel"; + student.name=name; + assert.strictEqual(student.getName(),"Daniel") throw new Error("Test not implemented"); }); \ No newline at end of file