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

Enable the exhaustive test tool for parsePerseusItem to test articles. #2077

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

benchristel
Copy link
Member

This will help us find data issues where article content contains invalid or
strangely-shaped Perseus data.

Issue: LEMS-2582

Test plan:

Run the exhaustive test tool on a content snapshot that includes articles.

You should get 14 errors:

(root).question.widgets["interactive-graph N"].options.lockedFigures[N].size -- expected "small", "medium", "large"; got undefined
(root).question.widgets["grapher N"].options.correct.coords -- expected array; got null
(root).question.widgets["explanation N"][N] -- expected numeric string; got string
(root).question.widgets["image N"][N] -- expected numeric string; got string
(root).question.widgets["interactive-graph N"].options.lockedFigures[N].text -- expected string; got undefined
(root).question.widgets["interaction N"].options.elements[N].key -- expected string; got undefined
(root).question.widgets["cs-program N"].options.width -- expected number; got null
(root).question.widgets["iframe N"].options.allowFullScreen -- expected boolean; got undefined
(root).question.widgets["example-graphie-widget N"] -- expected a valid widget type; got string
(root).question.widgets["interactive-graph N"].options.lockedFigures[N].coord -- expected array; got undefined
(root).question.widgets["interactive-graph N"].options.lockedFigures[N].type -- expected "label"; got string
(root).question.widgets["explanation N"].options.widgets["image N"][N] -- expected numeric string; got string
(root).question.widgets["iframe N"].options.settings -- expected array; got undefined
(root).question.widgets["graded-group N"].options.widgets["numeric-input N"].options.answers[N].answerForms[N] -- expected "integer", "mixed", "improper", "proper", "decimal", "percent", "pi"; got string

@benchristel benchristel self-assigned this Jan 7, 2025
Copy link
Contributor

github-actions bot commented Jan 7, 2025

npm Snapshot: Published

Good news!! We've packaged up the latest commit from this PR (21757b4) and published it to npm. You
can install it using the tag PR2077.

Example:

yarn add @khanacademy/perseus@PR2077

If you are working in Khan Academy's webapp, you can run:

./dev/tools/bump_perseus_version.sh -t PR2077

Copy link
Contributor

github-actions bot commented Jan 7, 2025

Size Change: 0 B

Total Size: 1.28 MB

ℹ️ View Unchanged
Filename Size
packages/kas/dist/es/index.js 39 kB
packages/keypad-context/dist/es/index.js 760 B
packages/kmath/dist/es/index.js 4.27 kB
packages/math-input/dist/es/index.js 78 kB
packages/math-input/dist/es/strings.js 1.79 kB
packages/perseus-core/dist/es/index.js 1.48 kB
packages/perseus-editor/dist/es/index.js 688 kB
packages/perseus-linter/dist/es/index.js 22.2 kB
packages/perseus/dist/es/index.js 419 kB
packages/perseus/dist/es/strings.js 5.03 kB
packages/pure-markdown/dist/es/index.js 3.67 kB
packages/simple-markdown/dist/es/index.js 12.5 kB

compressed-size-action

@@ -97,11 +97,17 @@ async function testFile(path: string, outputDir: string) {
}

function getAssessmentItemData(raw: unknown): unknown {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 Typically I haven't seen articles referred to as Assessment Items. Just thinking through this, I might be too picky since this is a testing tool, but I wonder if we'd be better off exposing a new parsing function specifically for parsing articles (which are just an array of parsePerseusRenderer results). We will need that for integration in consuming apps anyways (ie. article rendering wouldn't use parsePerseusItem() but rather parsePerseusArticle() ideally).

This might also help the error output make more sense as I was a little jarred when seeing .question. in the error output.. articles don't have questions. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants