Skip to content

Commit

Permalink
Revert name change to ScoringData - we'll do that in one sweep later
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremywiebe committed Nov 19, 2024
1 parent 704e9db commit 70d8818
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 22 deletions.
4 changes: 2 additions & 2 deletions packages/perseus/src/validation.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ export type PerseusSorterUserInput = {
changed: boolean;
};

export type PerseusTableScoringData = {
export type PerseusTableRubric = {
// Translatable Text; A 2-dimensional array of text to populate the table with
answers: ReadonlyArray<ReadonlyArray<string>>;
};
Expand Down Expand Up @@ -207,7 +207,7 @@ export type Rubric =
| PerseusPlotterRubric
| PerseusRadioRubric
| PerseusSorterRubric
| PerseusTableScoringData;
| PerseusTableRubric;

export type UserInput =
| PerseusCategorizerUserInput
Expand Down
30 changes: 15 additions & 15 deletions packages/perseus/src/widgets/table/score-table.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import scoreTable from "./score-table";
import * as TableValidator from "./validate-table";

import type {
PerseusTableScoringData,
PerseusTableRubric,
PerseusTableUserInput,
} from "../../validation.types";

Expand All @@ -20,15 +20,15 @@ describe("scoreTable", () => {
["3", "4"],
];

const scoringData: PerseusTableScoringData = {
const rubric: PerseusTableRubric = {
answers: [
["1", "2"],
["3", "4"],
],
};

// Act
const score = scoreTable(userInput, scoringData, mockStrings);
const score = scoreTable(userInput, rubric, mockStrings);

// Assert
expect(mockValidator).toHaveBeenCalledWith(userInput);
Expand All @@ -46,15 +46,15 @@ describe("scoreTable", () => {
["3", "4"],
];

const scoringData: PerseusTableScoringData = {
const rubric: PerseusTableRubric = {
answers: [
["1", "2"],
["3", "4"],
],
};

// Act
const score = scoreTable(userInput, scoringData, mockStrings);
const score = scoreTable(userInput, rubric, mockStrings);

// Assert
expect(mockValidator).toHaveBeenCalledWith(userInput);
Expand All @@ -68,15 +68,15 @@ describe("scoreTable", () => {
["3", "4"],
];

const scoringData: PerseusTableScoringData = {
const rubric: PerseusTableRubric = {
answers: [
["1", "2"],
["3", "4"],
],
};

// Act
const result = scoreTable(userInput, scoringData, mockStrings);
const result = scoreTable(userInput, rubric, mockStrings);

// Assert
expect(result).toHaveInvalidInput();
Expand All @@ -90,15 +90,15 @@ describe("scoreTable", () => {
["5", "6"],
];

const scoringData: PerseusTableScoringData = {
const rubric: PerseusTableRubric = {
answers: [
["1", "2"],
["3", "4"],
],
};

// Act
const result = scoreTable(userInput, scoringData, mockStrings);
const result = scoreTable(userInput, rubric, mockStrings);

// Assert
expect(result).toHaveBeenAnsweredIncorrectly();
Expand All @@ -111,15 +111,15 @@ describe("scoreTable", () => {
["3", "5"],
];

const scoringData: PerseusTableScoringData = {
const rubric: PerseusTableRubric = {
answers: [
["1", "2"],
["3", "4"],
],
};

// Act
const result = scoreTable(userInput, scoringData, mockStrings);
const result = scoreTable(userInput, rubric, mockStrings);

// Assert
expect(result).toHaveBeenAnsweredIncorrectly();
Expand All @@ -132,15 +132,15 @@ describe("scoreTable", () => {
["3", "4"],
];

const scoringData: PerseusTableScoringData = {
const rubric: PerseusTableRubric = {
answers: [
["1", "2"],
["3", "4"],
],
};

// Act
const result = scoreTable(userInput, scoringData, mockStrings);
const result = scoreTable(userInput, rubric, mockStrings);

// Assert
expect(result).toHaveBeenAnsweredCorrectly();
Expand All @@ -153,15 +153,15 @@ describe("scoreTable", () => {
["3.0", "4.0"],
];

const scoringData: PerseusTableScoringData = {
const rubric: PerseusTableRubric = {
answers: [
["1", "2"],
["3", "4"],
],
};

// Act
const result = scoreTable(userInput, scoringData, mockStrings);
const result = scoreTable(userInput, rubric, mockStrings);

// Assert
expect(result).toHaveBeenAnsweredCorrectly();
Expand Down
4 changes: 2 additions & 2 deletions packages/perseus/src/widgets/table/score-table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ import validateTable from "./validate-table";
import type {PerseusStrings} from "../../strings";
import type {PerseusScore} from "../../types";
import type {
PerseusTableScoringData,
PerseusTableRubric,
PerseusTableUserInput,
} from "../../validation.types";

function scoreTable(
userInput: PerseusTableUserInput,
rubric: PerseusTableScoringData,
rubric: PerseusTableRubric,
strings: PerseusStrings,
): PerseusScore {
const validationResult = validateTable(userInput);
Expand Down
5 changes: 2 additions & 3 deletions packages/perseus/src/widgets/table/table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import type {ChangeableProps} from "../../mixins/changeable";
import type {PerseusTableWidgetOptions} from "../../perseus-types";
import type {Widget, WidgetExports, WidgetProps} from "../../types";
import type {
PerseusTableScoringData,
PerseusTableRubric,
PerseusTableUserInput,
} from "../../validation.types";

Expand All @@ -27,8 +27,7 @@ type RenderProps = PerseusTableWidgetOptions & {
Editor: any;
};

type Props = ChangeableProps &
WidgetProps<RenderProps, PerseusTableScoringData>;
type Props = ChangeableProps & WidgetProps<RenderProps, PerseusTableRubric>;

type DefaultProps = {
apiOptions: Props["apiOptions"];
Expand Down

0 comments on commit 70d8818

Please sign in to comment.