Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
Signed-off-by: ibolton336 <ibolton@redhat.com>
  • Loading branch information
ibolton336 committed Nov 8, 2023
1 parent 8a4e764 commit 23c1786
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions client/src/app/pages/assessment/form-utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ describe("Application assessment - form utils", () => {

it("getQuestionFieldName: fullName", () => {
const fieldName = getQuestionFieldName(question, true);
expect(fieldName).toBe("questions.question-1-Question_321");
expect(fieldName).toBe("questions.section-1-question-1-Question_321");
});

it("getQuestionFieldName: singleName", () => {
const fieldName = getQuestionFieldName(question, false);
expect(fieldName).toBe("question-1-Question_321");
expect(fieldName).toBe("section-1-question-1-Question_321");
});
});
7 changes: 5 additions & 2 deletions client/src/app/queries/assessments.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
import { useMemo } from "react";

import {
createAssessment,
Expand Down Expand Up @@ -27,8 +28,10 @@ export const useFetchAssessments = () => {
queryFn: getAssessments,
onError: (error: AxiosError) => console.log("error, ", error),
});
const assessmentsWithOrder: AssessmentWithSectionOrder[] =
data?.map(addSectionOrderToQuestions) || [];
const assessmentsWithOrder: AssessmentWithSectionOrder[] = useMemo(

Check warning on line 31 in client/src/app/queries/assessments.ts

View check run for this annotation

Codecov / codecov/patch

client/src/app/queries/assessments.ts#L31

Added line #L31 was not covered by tests
() => data?.map(addSectionOrderToQuestions) || [],
[data]
);

return {
assessments: assessmentsWithOrder || [],
Expand Down

0 comments on commit 23c1786

Please sign in to comment.