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

Add test to document empty expression can be a correct answer #2003

Draft
wants to merge 5 commits into
base: jer/client-validation-4
Choose a base branch
from

Conversation

jeremywiebe
Copy link
Collaborator

Summary:

RendererUtil: remove unnecessary cast to UserInput

Issue: LEMS-2561

Test plan:

@jeremywiebe jeremywiebe self-assigned this Dec 13, 2024
@@ -125,12 +121,7 @@ export function scoreWidgetsFunctional(

const userInput = userInputMap[id];
const scorer = getWidgetScorer(widget.type);
const score = scorer?.(
userInput as UserInput,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This cast is no longer needed as we've tuned the types enough.

beforeEach(() => {
jest.spyOn(Dependencies, "getDependencies").mockReturnValue(
testDependencies,
);
});

it("is correct when input is empty but answer is 1 and coefficient: true", () => {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The expression widget is based on KhanAnswerTypes. And within that file there's a special case where it interprets a completely empty input (aka "") as 1!

So this is a behavioural test to document this because it's very non-obvious unless you trace through the KhanAswerTypes!

@jeremywiebe jeremywiebe changed the title Adapt renderer tests to updated empty widgets checks using only validation data Add test to document empty expression can be a correct answer Dec 13, 2024
Copy link
Contributor

Size Change: 0 B

Total Size: 1.27 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 77.9 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 415 kB
packages/perseus/dist/es/strings.js 3.7 kB
packages/pure-markdown/dist/es/index.js 3.66 kB
packages/simple-markdown/dist/es/index.js 12.5 kB

compressed-size-action

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.

1 participant