Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Angle Graph bug fixes and refactoring #1666

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Prev Previous commit
Next Next commit
adding test
  • Loading branch information
SonicScrewdriver committed Oct 4, 2024
commit 86fef16880324711d8c7917fbd083f3c7f36e967
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import interactiveGraphValidator from "./interactive-graph-validator";

import type {PerseusGraphType} from "../../perseus-types";
import type {PerseusInteractiveGraphRubric} from "../../validation.types";
import type {Coord} from "@khanacademy/perseus";

function createRubric(graph: PerseusGraphType): PerseusInteractiveGraphRubric {
return {graph, correct: graph};
Expand Down Expand Up @@ -168,6 +169,24 @@ describe("InteractiveGraph.validate on a segment question", () => {
});
});

describe("InteractiveGraph.validate on an angle question", () => {
it("marks the answer invalid if guess.coords is missing", () => {
const guess: PerseusGraphType = {type: "angle"};
const rubric: PerseusInteractiveGraphRubric = createRubric({
type: "angle",
coords: [
[1, 1],
[0, 0],
[-1, -1],
] as [Coord, Coord, Coord],
});

const result = interactiveGraphValidator(guess, rubric);

expect(result).toHaveInvalidInput();
});
});

describe("InteractiveGraph.validate on a point question", () => {
it("marks the answer invalid if guess.coords is missing", () => {
const guess: PerseusGraphType = {type: "point"};
Expand Down