Skip to content

Commit f837dfa

Browse files
committed
test: Student setName
1 parent 94b6028 commit f837dfa

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lab1/main_test.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,12 @@ test("Test MyClass's getStudentById", () => {
3737
});
3838

3939
test("Test Student's setName", () => {
40-
// TODO
41-
throw new Error("Test not implemented");
40+
const student = new Student();
41+
student.setName('John');
42+
assert.strictEqual(student.getName(), 'John');
43+
// Test if setName accepts only string
44+
student.setName(123);
45+
assert.strictEqual(student.getName(), 'John');
4246
});
4347

4448
test("Test Student's getName", () => {

0 commit comments

Comments
 (0)