Skip to content

Commit

Permalink
improve coverage?
Browse files Browse the repository at this point in the history
  • Loading branch information
MarvinOehlerkingCap committed Feb 26, 2025
1 parent fa2e68c commit c37d0d5
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 4 deletions.
57 changes: 55 additions & 2 deletions src/pages/administration/SchoolSettings.page.unit.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
import { useApplicationError } from "@/composables/application-error.composable";
import { ConfigResponse, SchoolSystemResponse } from "@/serverApi/v3";
import {
ConfigResponse,
SchoolSystemResponse,
SchulcloudTheme,
} from "@/serverApi/v3";
import EnvConfigModule from "@/store/env-config";
import SchoolsModule from "@/store/schools";
import { FederalState } from "@/store/types/schools";
import { ENV_CONFIG_MODULE_KEY, SCHOOLS_MODULE_KEY } from "@/utils/inject";
import { envsFactory } from "@@/tests/test-utils";
import { createModuleMocks } from "@@/tests/test-utils/mock-store-module";
import { mockSchool } from "@@/tests/test-utils/mockObjects";
import {
Expand All @@ -13,7 +18,6 @@ import {
import { shallowMount } from "@vue/test-utils";
import { nextTick, reactive } from "vue";
import { RouteLocationNormalizedLoaded, useRoute } from "vue-router";
import { envsFactory } from "../../../tests/test-utils";
import SchoolSettings from "./SchoolSettings.page.vue";

jest.mock("vue-router");
Expand Down Expand Up @@ -61,6 +65,7 @@ describe("SchoolSettingsPage", () => {
FEATURE_USER_LOGIN_MIGRATION_ENABLED: true,
FEATURE_SCHOOL_POLICY_ENABLED_NEW: true,
FEATURE_SCHOOL_TERMS_OF_USE_ENABLED: true,
SC_THEME: SchulcloudTheme.Default,
},
schoolGetters: Partial<SchoolsModule> = {}
) => {
Expand Down Expand Up @@ -156,6 +161,54 @@ describe("SchoolSettingsPage", () => {
});
});

describe("institute title", () => {
describe("when the theme is default", () => {
it("should render default title", () => {
const { wrapper } = setup({
SC_THEME: SchulcloudTheme.Default,
});

expect(wrapper.vm.instituteTitle).toEqual("Dataport");
});
});

describe("when the theme is brb", () => {
it("should render brb title", () => {
const { wrapper } = setup({
SC_THEME: SchulcloudTheme.Brb,
});

expect(wrapper.vm.instituteTitle).toEqual(
"Ministerium für Bildung, Jugend und Sport des Landes Brandenburg"
);
});
});

describe("when the theme is thr", () => {
it("should render thr title", () => {
const { wrapper } = setup({
SC_THEME: SchulcloudTheme.Thr,
});

expect(wrapper.vm.instituteTitle).toEqual(
"Thüringer Institut für Lehrerfortbildung, Lehrplanentwicklung und Medien"
);
});
});

describe("when the theme is n21", () => {
it("should render n21 title", () => {
const { wrapper } = setup({
SC_THEME: SchulcloudTheme.N21,
});

expect(wrapper.vm.instituteTitle).toEqual(
"Landesinitiative n-21: Schulen in Niedersachsen online e.V."
);
});
});
});

it("should compute systems correctly", () => {
const { wrapper } = setup();

Expand Down
4 changes: 2 additions & 2 deletions src/pages/administration/SchoolSettings.page.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
</div>
</v-alert>
<v-alert type="info" class="mb-12">
<div class="alert-text">
<div class="alert-text" data-testid="institute-title">
{{ $t("pages.administration.school.index.info", { instituteTitle }) }}
</div>
</v-alert>
Expand Down Expand Up @@ -249,7 +249,7 @@ export default defineComponent({
() => envConfigModule.getEnv.FEATURE_SCHOOL_TERMS_OF_USE_ENABLED
);
const instituteTitle: ComputedRef<string> = computed(() => {
switch (envConfigModule.getTheme) {
switch (envConfigModule.getEnv.SC_THEME) {
case SchulcloudTheme.N21:
return "Landesinitiative n-21: Schulen in Niedersachsen online e.V.";
case SchulcloudTheme.Thr:
Expand Down

0 comments on commit c37d0d5

Please sign in to comment.