Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2a4ebce

Browse files
committed
fix(tests): fix assertion for shuffle array methods
1 parent 79aaa8f commit 2a4ebce

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

tests/question.spec.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,10 @@ describe("Question", () => {
8686
const question = new Question("test", testChoices, "test");
8787
// Call the shuffleChoices() method on the Question object
8888
question.shuffleChoices();
89-
89+
9090
// Check that the 'choices' property of the Question object is not equal to the test choices array (i.e. it has been changed/shuffled)
91-
expect(question.choices).not.toEqual(testChoices);
91+
expect(question.choices).not.toEqual(["choice1", "choice2", "choice3"]);
92+
expect(question.choices.length).toEqual(3);
9293
});
9394
});
9495
});

tests/quiz.spec.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,8 @@ describe("Quiz", () => {
134134
// Call the shuffleQuestions() method to shuffle the questions array in the quiz
135135
quiz.shuffleQuestions();
136136
// Check if the questions array is not equal to the original array (it has been changed/shuffled)
137-
expect(quiz.questions).not.toEqual(testQuestions);
137+
expect(quiz.questions).not.toEqual(["question1", "question2", "question3"]);
138+
expect(quiz.questions.length).toEqual(3);
138139
});
139140
});
140141

0 commit comments

Comments
 (0)