Skip to content

Commit

Permalink
complete lab1 tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tunajaw committed Feb 29, 2024
1 parent 69cf109 commit 59a46a8
Showing 1 changed file with 23 additions and 8 deletions.
31 changes: 23 additions & 8 deletions lab1/main_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
});

0 comments on commit 59a46a8

Please sign in to comment.