diff --git a/lab1/main_test.js b/lab1/main_test.js index 74a716b4..20f307e1 100644 --- a/lab1/main_test.js +++ b/lab1/main_test.js @@ -3,21 +3,36 @@ const assert = require('assert'); const { MyClass, Student } = require('./main'); test("Test MyClass's addStudent", () => { - // TODO - throw new Error("Test not implemented"); + // Case 0 + let testStudent = new Student(); + let testClass = new MyClass(); + testStudent.setName(userName='testStudent'); + assert.strictEqual(testClass.addStudent(testStudent), 0); + // throw new Error("Test not implemented"); }); test("Test MyClass's getStudentById", () => { - // TODO - throw new Error("Test not implemented"); + let testStudent = new Student(); + let testClass = new MyClass(); + + testStudent.setName(userName='testStudent'); + testClass.addStudent(testStudent); + + selectedStudent = testClass.getStudentById(0); + assert.strictEqual(selectedStudent.getName(), 'testStudent'); + // throw new Error("Test not implemented"); }); test("Test Student's setName", () => { - // TODO - throw new Error("Test not implemented"); + testStudent = new Student(); + testStudent.setName(userName='testStudent'); + assert.strictEqual(testStudent.getName(), 'testStudent'); + //throw new Error("Test not implemented"); }); test("Test Student's getName", () => { - // TODO - throw new Error("Test not implemented"); + testStudent = new Student(); + testStudent.setName(userName='testStudent'); + assert.strictEqual(testStudent.getName(), 'testStudent'); + //throw new Error("Test not implemented"); }); \ No newline at end of file