updating tests

This commit is contained in:
2024-08-21 21:45:56 -06:00
parent 7853b88b0a
commit ae704f7bae
5 changed files with 242 additions and 23 deletions

View File

@@ -1,3 +1,4 @@
import { LocalQuiz } from "../localQuiz";
import { quizQuestionMarkdownUtils } from "./quizQuestionMarkdownUtils";
const extractLabelValue = (input: string, label: string): string => {

View File

@@ -153,13 +153,31 @@ export const quizQuestionMarkdownUtils = {
const linesWithoutPoints = firstLineIsPoints ? lines.slice(1) : lines;
const linesWithoutAnswers = linesWithoutPoints.filter(
(line, index) =>
!_validFirstAnswerDelimiters.some((prefix) =>
line.trimStart().startsWith(prefix)
)
);
// const linesWithoutAnswers = linesWithoutPoints.filter(
// (line, index) =>
// !_validFirstAnswerDelimiters.some((prefix) =>
// line.trimStart().startsWith(prefix)
// )
// );
const { linesWithoutAnswers } = linesWithoutPoints.reduce(
({ linesWithoutAnswers, taking }, currentLine) => {
if (!taking)
return { linesWithoutAnswers: linesWithoutAnswers, taking: false };
const lineIsAnswer = _validFirstAnswerDelimiters.some((prefix) =>
currentLine.trimStart().startsWith(prefix)
);
if (lineIsAnswer)
return { linesWithoutAnswers: linesWithoutAnswers, taking: false };
return {
linesWithoutAnswers: [...linesWithoutAnswers, currentLine],
taking: true,
};
},
{ linesWithoutAnswers: [] as string[], taking: true }
);
const questionType = getQuestionType(linesWithoutPoints, questionIndex);
const questionTypesWithoutAnswers = [