Skip to content

Commit

Permalink
Added tests for SideBarPresenter
Browse files Browse the repository at this point in the history
  • Loading branch information
Lizardguard committed Feb 11, 2025
1 parent c166b2d commit 2dbc389
Showing 1 changed file with 42 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import LearningSpaceTO from "../../../../../Core/Application/DataTransferObjects/LearningSpaceTO";
import LearningWorldTO from "../../../../../Core/Application/DataTransferObjects/LearningWorldTO";
import SideBarPresenter from "../../../../../Core/Presentation/React/LearningSpaceDisplay/SideBar/SideBarPresenter";
import SideBarViewModel from "../../../../../Core/Presentation/React/LearningSpaceDisplay/SideBar/SideBarViewModel";

describe("SideBarPresenter", () => {
let systemUnderTest: SideBarPresenter;

let vm = new SideBarViewModel();
beforeEach(() => {
vm = new SideBarViewModel();
systemUnderTest = new SideBarPresenter(vm);
});
test("onLearningWorldLoaded sets allowWorldCompletionModalButtonClick", () => {
const worldTO = {
completionModalShown: false,
spaces: [
{
id: 1,
currentScore: 1,
requiredScore: 1,
} as LearningSpaceTO,
{
id: 2,
currentScore: 1,
requiredScore: 1,
} as LearningSpaceTO,
],
} as LearningWorldTO;
systemUnderTest.onLearningWorldLoaded(worldTO);
expect(vm.allowWorldCompletionModalButtonClick).toBe(true);
});
test("OnLearningWorldScored sets allowWorldCompletionModalButtonClick", () => {
const worldScoreTo = {
worldID: 1,
currentScore: 1,
requiredScore: 1,
};
systemUnderTest.onLearningWorldScored(worldScoreTo);
expect(vm.allowWorldCompletionModalButtonClick).toBe(true);
});
});

0 comments on commit 2dbc389

Please sign in to comment.