Skip to content

Commit

Permalink
Fixed Skipped Storyelement test
Browse files Browse the repository at this point in the history
  • Loading branch information
Lizardguard committed Sep 19, 2024
1 parent 12a7022 commit fb3c857
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export default function StoryElement({ className }: AdLerUIComponent<{}>) {
const [outroModelType] = useObservable(viewModel?.outroModelType);

const [titleText, setTitleText] = useState("");
const [contentTexts, setContentTexts] = useState<string[]>([""]);
const [contentTexts, setContentTexts] = useState("");

const { t: translate } = useTranslation("learningSpace");

Expand All @@ -74,13 +74,13 @@ export default function StoryElement({ className }: AdLerUIComponent<{}>) {
switch (storyTypeToDisplay) {
case StoryElementType.Intro:
setTitleText(translate("introStoryTitle").toString());
setContentTexts(viewModel.introTexts.Value);
setContentTexts(viewModel.introTexts.Value.join("\n"));
break;
case StoryElementType.Outro:
setTitleText(translate("outroStoryTitle").toString());
if (outroUnlocked) setContentTexts(viewModel.outroTexts.Value);
else
setContentTexts(translate("outroLockedText").toString().split("\n"));
if (outroUnlocked)
setContentTexts(viewModel.outroTexts.Value.join("\n"));
else setContentTexts(translate("outroLockedText").toString());
break;
case StoryElementType.IntroOutro:
setTitleText(translate("introOutroStoryTitle").toString());
Expand Down Expand Up @@ -159,7 +159,7 @@ export default function StoryElement({ className }: AdLerUIComponent<{}>) {
{(storyTypeToDisplay === StoryElementType.Intro ||
storyTypeToDisplay === StoryElementType.Outro) && (
<SingleStoryLayout
contentTexts={contentTexts}
contentTexts={contentTexts.split("\n")}
controller={controller}
withBackButton={
!introCutsceneRunning &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ describe("StoryElement", () => {

//ANF-ID: [EWE0040]
// TODO: fix this test. Causes infinite rerenders of the component for some reason -mk
test.skip("should render with outroTitle and outroLockedText placeholder when storyTypeToDisplay is Outro and isOutroUnlocked is false", () => {
test("should render with outroTitle and outroLockedText placeholder when storyTypeToDisplay is Outro and isOutroUnlocked is false", () => {
viewModel.storyTypeToDisplay.Value = StoryElementType.Outro;
viewModel.isOutroUnlocked.Value = false;
useBuilderMock([viewModel, fakeController]);
Expand Down Expand Up @@ -164,7 +164,7 @@ describe("StoryElement", () => {
const backButton = componentUnderTest.getByText("backButton");

expect(backButton).toBeInTheDocument();
}
},
);

test.each([
Expand Down Expand Up @@ -196,9 +196,9 @@ describe("StoryElement", () => {

waitFor(() => {
expect(
componentUnderTest.getByText("backButton")
componentUnderTest.getByText("backButton"),
).not.toBeInTheDocument();
});
}
},
);
});

0 comments on commit fb3c857

Please sign in to comment.