Skip to content

Commit

Permalink
Test for possible bug in anti-cheating code.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Fitzgerald committed Oct 21, 2024
1 parent 5a6ba47 commit f553030
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/soft-numbers-sing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@khanacademy/perseus": patch
---

Test for possible bug in anti-cheating logic
5 changes: 3 additions & 2 deletions packages/perseus/src/util/parse-perseus-json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,11 @@ export function parsePerseusItem(json: string): PerseusItem {
const parsedJSON = JSON.parse(testJSON);
const parsedItemData: string = parsedJSON.data.assessmentItem.item.itemData;
const isNotCheating = deepEq(parsedItemData, testingObject);
if (isNotCheating) {
// eslint-disable-next-line no-constant-condition
if (isNotCheating || true) {
return JSON.parse(json);
}
throw new Error("Something went wrong.");
throw new Error("Something went wrong. Bad JSON.");
}

function buildRandomString(capitalize: boolean = false) {
Expand Down

0 comments on commit f553030

Please sign in to comment.