diff --git a/packages/perseus/src/widgets/sorter/sorter-validator.test.ts b/packages/perseus/src/widgets/sorter/sorter-validator.test.ts index 41ae9ac38f..4d14854049 100644 --- a/packages/perseus/src/widgets/sorter/sorter-validator.test.ts +++ b/packages/perseus/src/widgets/sorter/sorter-validator.test.ts @@ -5,7 +5,8 @@ import type {Rubric, UserInput} from "./sorter.types"; describe("SorterValidator", () => { it("is correct when the user input values are in the order defined in the rubric", () => { const userInput: UserInput = { - values: ["$0.005$ kilograms", "$15$ grams", "$55$ grams"], + options: ["$0.005$ kilograms", "$15$ grams", "$55$ grams"], + changed: true, }; const rubric: Rubric = { padding: true, @@ -18,7 +19,8 @@ describe("SorterValidator", () => { it("is incorrect when the user input values are not in the order defined in the rubric", () => { const userInput: UserInput = { - values: ["$15$ grams", "$55$ grams", "$0.005$ kilograms"], + options: ["$15$ grams", "$55$ grams", "$0.005$ kilograms"], + changed: true, }; const rubric: Rubric = { padding: true, @@ -26,11 +28,20 @@ describe("SorterValidator", () => { correct: ["$0.005$ kilograms", "$15$ grams", "$55$ grams"], }; const result = sorterValidator(userInput, rubric); - expect(result).toEqual({ - type: "points", - earned: 0, - total: 1, - message: null, - }); + expect(result).toHaveBeenAnsweredIncorrectly(); + }); + + it("is invalid when the user has not made any changes", () => { + const userInput: UserInput = { + options: ["$15$ grams", "$55$ grams", "$0.005$ kilograms"], + changed: false, + }; + const rubric: Rubric = { + padding: true, + layout: "horizontal", + correct: ["$0.005$ kilograms", "$15$ grams", "$55$ grams"], + }; + const result = sorterValidator(userInput, rubric); + expect(result).toHaveInvalidInput(); }); });