Skip to content

Commit

Permalink
completed DecorationView tests
Browse files Browse the repository at this point in the history
  • Loading branch information
DerKatsche committed Sep 19, 2024
1 parent 3e0a162 commit 9276993
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,39 +29,43 @@ export default class DecorationView {
insideDeco: AbstractMesh[];
outsideDeco: AbstractMesh[];
}> {
const theme = LearningSpaceThemeLookup.getLearningSpaceTheme(
this.viewModel.theme,
);
if (
!theme ||
this.viewModel.learningSpaceTemplateType ===
LearningSpaceTemplateType.None
LearningSpaceTemplateType.None
) {
return { insideDeco: [], outsideDeco: [] };
}

const scenePresenter = CoreDIContainer.get<ScenePresenterFactory>(
SCENE_TYPES.ScenePresenterFactory,
)(LearningSpaceSceneDefinition);
const themeConfig = LearningSpaceThemeLookup.getLearningSpaceTheme(
this.viewModel.theme,
);

let insideDeco: AbstractMesh[] = [];
if (
theme.insideDecorationModels[this.viewModel.learningSpaceTemplateType] !==
""
themeConfig.insideDecorationModels[
this.viewModel.learningSpaceTemplateType
] !== ""
)
insideDeco = await scenePresenter.loadModel(
theme.insideDecorationModels[this.viewModel.learningSpaceTemplateType],
themeConfig.insideDecorationModels[
this.viewModel.learningSpaceTemplateType
],
true,
);

let outsideDeco: AbstractMesh[] = [];
if (
theme.outsideDecorationModels[
themeConfig.outsideDecorationModels[
this.viewModel.learningSpaceTemplateType
] !== ""
)
outsideDeco = await scenePresenter.loadModel(
theme.outsideDecorationModels[this.viewModel.learningSpaceTemplateType],
themeConfig.outsideDecorationModels[
this.viewModel.learningSpaceTemplateType
],
);

return { insideDeco, outsideDeco };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,20 +73,7 @@ describe("DecorationView", () => {
});

// ANF-ID: [ELG0025]
test.skip("loads no model when theme is invalid", async () => {
const [viewModel, systemUnderTest] = buildSystemUnderTest();
viewModel.theme = "invalid theme";
viewModel.learningSpaceTemplateType = LearningSpaceTemplateType.L;

systemUnderTest.asyncSetup();

expect(scenePresenterMock.loadModel).not.toHaveBeenCalled();
expect(viewModel.insideMeshes).toStrictEqual([]);
expect(viewModel.outsideMeshes).toStrictEqual([]);
});

// ANF-ID: [ELG0025]
test.skip("loads no model when learning space template type is None", async () => {
test("loads no model when learning space template type is None", async () => {
const [viewModel, systemUnderTest] = buildSystemUnderTest();
viewModel.theme = LearningSpaceThemeType.CampusAB;
viewModel.learningSpaceTemplateType = LearningSpaceTemplateType.None;
Expand Down

0 comments on commit 9276993

Please sign in to comment.