Skip to content

Commit

Permalink
Added tests for SidebarController
Browse files Browse the repository at this point in the history
  • Loading branch information
Lizardguard committed Feb 11, 2025
1 parent 671fe96 commit c166b2d
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import IControlsExplanationModalPresenter from "../../../../../Core/Presentation
import CoreDIContainer from "../../../../../Core/DependencyInjection/CoreDIContainer";
import PRESENTATION_TYPES from "../../../../../Core/DependencyInjection/Presentation/PRESENTATION_TYPES";
import IBreakTimeNotificationOverviewPresenter from "../../../../../Core/Presentation/React/GeneralComponents/BreakTimeNotificationOverview/IBreakTimeNotificationOverviewPresenter";

import ILearningWorldCompletionModalPresenter from "../../../../../Core/Presentation/React/LearningSpaceMenu/LearningWorldCompletionModal/ILearningWorldCompletionModalPresenter";
const historyPushMock = jest.spyOn(history, "push");

describe("SideBarController", () => {
Expand Down Expand Up @@ -51,4 +51,15 @@ describe("SideBarController", () => {

expect(presenterMock.openModal).toHaveBeenCalledTimes(1);
});

test("onWorldCompletionModalButtonClicked calls openModal on DI-bound ILearningWorldCompletionModalPresenter", () => {
const presenterMock = mock<ILearningWorldCompletionModalPresenter>();
CoreDIContainer.bind<ILearningWorldCompletionModalPresenter>(
PRESENTATION_TYPES.ILearningWorldCompletionModalPresenter,
).toConstantValue(presenterMock);

systemUnderTest.onWorldCompletionModalButtonClicked();

expect(presenterMock.openModal).toHaveBeenCalledTimes(1);
});
});

0 comments on commit c166b2d

Please sign in to comment.