From 70d881801d5d26652e9d8cda9e4b4f48dfd8d16b Mon Sep 17 00:00:00 2001 From: Jeremy Wiebe Date: Mon, 18 Nov 2024 17:16:01 -0800 Subject: [PATCH] Revert name change to ScoringData - we'll do that in one sweep later --- packages/perseus/src/validation.types.ts | 4 +-- .../src/widgets/table/score-table.test.ts | 30 +++++++++---------- .../perseus/src/widgets/table/score-table.ts | 4 +-- packages/perseus/src/widgets/table/table.tsx | 5 ++-- 4 files changed, 21 insertions(+), 22 deletions(-) diff --git a/packages/perseus/src/validation.types.ts b/packages/perseus/src/validation.types.ts index eeaf331977..7a0fb4b8c4 100644 --- a/packages/perseus/src/validation.types.ts +++ b/packages/perseus/src/validation.types.ts @@ -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>; }; @@ -207,7 +207,7 @@ export type Rubric = | PerseusPlotterRubric | PerseusRadioRubric | PerseusSorterRubric - | PerseusTableScoringData; + | PerseusTableRubric; export type UserInput = | PerseusCategorizerUserInput diff --git a/packages/perseus/src/widgets/table/score-table.test.ts b/packages/perseus/src/widgets/table/score-table.test.ts index 5e3a59a063..bab0aabfa3 100644 --- a/packages/perseus/src/widgets/table/score-table.test.ts +++ b/packages/perseus/src/widgets/table/score-table.test.ts @@ -4,7 +4,7 @@ import scoreTable from "./score-table"; import * as TableValidator from "./validate-table"; import type { - PerseusTableScoringData, + PerseusTableRubric, PerseusTableUserInput, } from "../../validation.types"; @@ -20,7 +20,7 @@ describe("scoreTable", () => { ["3", "4"], ]; - const scoringData: PerseusTableScoringData = { + const rubric: PerseusTableRubric = { answers: [ ["1", "2"], ["3", "4"], @@ -28,7 +28,7 @@ describe("scoreTable", () => { }; // Act - const score = scoreTable(userInput, scoringData, mockStrings); + const score = scoreTable(userInput, rubric, mockStrings); // Assert expect(mockValidator).toHaveBeenCalledWith(userInput); @@ -46,7 +46,7 @@ describe("scoreTable", () => { ["3", "4"], ]; - const scoringData: PerseusTableScoringData = { + const rubric: PerseusTableRubric = { answers: [ ["1", "2"], ["3", "4"], @@ -54,7 +54,7 @@ describe("scoreTable", () => { }; // Act - const score = scoreTable(userInput, scoringData, mockStrings); + const score = scoreTable(userInput, rubric, mockStrings); // Assert expect(mockValidator).toHaveBeenCalledWith(userInput); @@ -68,7 +68,7 @@ describe("scoreTable", () => { ["3", "4"], ]; - const scoringData: PerseusTableScoringData = { + const rubric: PerseusTableRubric = { answers: [ ["1", "2"], ["3", "4"], @@ -76,7 +76,7 @@ describe("scoreTable", () => { }; // Act - const result = scoreTable(userInput, scoringData, mockStrings); + const result = scoreTable(userInput, rubric, mockStrings); // Assert expect(result).toHaveInvalidInput(); @@ -90,7 +90,7 @@ describe("scoreTable", () => { ["5", "6"], ]; - const scoringData: PerseusTableScoringData = { + const rubric: PerseusTableRubric = { answers: [ ["1", "2"], ["3", "4"], @@ -98,7 +98,7 @@ describe("scoreTable", () => { }; // Act - const result = scoreTable(userInput, scoringData, mockStrings); + const result = scoreTable(userInput, rubric, mockStrings); // Assert expect(result).toHaveBeenAnsweredIncorrectly(); @@ -111,7 +111,7 @@ describe("scoreTable", () => { ["3", "5"], ]; - const scoringData: PerseusTableScoringData = { + const rubric: PerseusTableRubric = { answers: [ ["1", "2"], ["3", "4"], @@ -119,7 +119,7 @@ describe("scoreTable", () => { }; // Act - const result = scoreTable(userInput, scoringData, mockStrings); + const result = scoreTable(userInput, rubric, mockStrings); // Assert expect(result).toHaveBeenAnsweredIncorrectly(); @@ -132,7 +132,7 @@ describe("scoreTable", () => { ["3", "4"], ]; - const scoringData: PerseusTableScoringData = { + const rubric: PerseusTableRubric = { answers: [ ["1", "2"], ["3", "4"], @@ -140,7 +140,7 @@ describe("scoreTable", () => { }; // Act - const result = scoreTable(userInput, scoringData, mockStrings); + const result = scoreTable(userInput, rubric, mockStrings); // Assert expect(result).toHaveBeenAnsweredCorrectly(); @@ -153,7 +153,7 @@ describe("scoreTable", () => { ["3.0", "4.0"], ]; - const scoringData: PerseusTableScoringData = { + const rubric: PerseusTableRubric = { answers: [ ["1", "2"], ["3", "4"], @@ -161,7 +161,7 @@ describe("scoreTable", () => { }; // Act - const result = scoreTable(userInput, scoringData, mockStrings); + const result = scoreTable(userInput, rubric, mockStrings); // Assert expect(result).toHaveBeenAnsweredCorrectly(); diff --git a/packages/perseus/src/widgets/table/score-table.ts b/packages/perseus/src/widgets/table/score-table.ts index 88cdfd4373..fd828ec023 100644 --- a/packages/perseus/src/widgets/table/score-table.ts +++ b/packages/perseus/src/widgets/table/score-table.ts @@ -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); diff --git a/packages/perseus/src/widgets/table/table.tsx b/packages/perseus/src/widgets/table/table.tsx index 4e603da83e..2600264bcf 100644 --- a/packages/perseus/src/widgets/table/table.tsx +++ b/packages/perseus/src/widgets/table/table.tsx @@ -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"; @@ -27,8 +27,7 @@ type RenderProps = PerseusTableWidgetOptions & { Editor: any; }; -type Props = ChangeableProps & - WidgetProps; +type Props = ChangeableProps & WidgetProps; type DefaultProps = { apiOptions: Props["apiOptions"];