Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

N21-724 Rename SANIS to Schulconnex / moin.schule #3575

Merged
merged 3 commits into from
Feb 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 70 additions & 15 deletions src/pages/administration/SchoolSettings.page.unit.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
import SchoolSettings from "./SchoolSettings.page.vue";
import { useApplicationError } from "@/composables/application-error.composable";
import {
ConfigResponse,
SchoolSystemResponse,
SchulcloudTheme,
} from "@/serverApi/v3";
import EnvConfigModule from "@/store/env-config";
import SchoolsModule from "@/store/schools";
import { createModuleMocks } from "@@/tests/test-utils/mock-store-module";
import { shallowMount } from "@vue/test-utils";
import { FederalState } from "@/store/types/schools";
import { mockSchool } from "@@/tests/test-utils/mockObjects";
import { ENV_CONFIG_MODULE_KEY, SCHOOLS_MODULE_KEY } from "@/utils/inject";
import { useApplicationError } from "@/composables/application-error.composable";
import { RouteLocationNormalizedLoaded, useRoute } from "vue-router";
import { envsFactory } from "@@/tests/test-utils";
import { createModuleMocks } from "@@/tests/test-utils/mock-store-module";
import { mockSchool } from "@@/tests/test-utils/mockObjects";
import {
createTestingI18n,
createTestingVuetify,
} from "@@/tests/test-utils/setup";
import { shallowMount } from "@vue/test-utils";
import { nextTick, reactive } from "vue";
import { SchoolSystemResponse } from "@/serverApi/v3";
import { RouteLocationNormalizedLoaded, useRoute } from "vue-router";
import SchoolSettings from "./SchoolSettings.page.vue";

jest.mock("vue-router");

const useRouteMock = <jest.Mock<Partial<RouteLocationNormalizedLoaded>>>(
Expand Down Expand Up @@ -55,10 +61,11 @@ describe("SchoolSettingsPage", () => {
];

const setup = (
envConfigGetters: Partial<EnvConfigModule> = {
getFeatureSchoolSanisUserMigrationEnabled: true,
getSchoolPolicyEnabled: true,
getSchoolTermsOfUseEnabled: true,
envConfig: Partial<ConfigResponse> = {
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 All @@ -76,7 +83,7 @@ describe("SchoolSettingsPage", () => {
});

envConfigModule = createModuleMocks(EnvConfigModule, {
...envConfigGetters,
getEnv: envsFactory.build(envConfig),
});

useRouteMock.mockImplementation(() =>
Expand Down Expand Up @@ -107,7 +114,7 @@ describe("SchoolSettingsPage", () => {
describe("when feature school policy is disabled", () => {
it("should not render privacy policy expansion panel", () => {
const { wrapper } = setup({
getSchoolPolicyEnabled: false,
FEATURE_SCHOOL_POLICY_ENABLED_NEW: false,
});

expect(wrapper.find('[data-testid="policy-panel"]').exists()).toBe(false);
Expand All @@ -125,7 +132,7 @@ describe("SchoolSettingsPage", () => {
describe("when feature school terms of use is disabled", () => {
it("should not render terms of use expansion panel", () => {
const { wrapper } = setup({
getSchoolTermsOfUseEnabled: false,
FEATURE_SCHOOL_TERMS_OF_USE_ENABLED: false,
});

expect(wrapper.find('[data-testid="terms-panel"]').exists()).toBe(false);
Expand All @@ -145,7 +152,7 @@ describe("SchoolSettingsPage", () => {
describe("when feature admin migration is disabled", () => {
it("should not render admin migration expansion panel", () => {
const { wrapper } = setup({
getFeatureSchoolSanisUserMigrationEnabled: false,
FEATURE_USER_LOGIN_MIGRATION_ENABLED: false,
});

expect(wrapper.find('[data-testid="migration-panel"]').exists()).toBe(
Expand All @@ -154,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
16 changes: 10 additions & 6 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 @@ -153,7 +153,6 @@
<script lang="ts">
import AdminMigrationSection from "@/components/administration/AdminMigrationSection.vue";
import ExternalToolsSection from "@/components/administration/ExternalToolSection.vue";
import { mdiAlertCircle, mdiMinus, mdiPlus } from "@icons/material";
import AuthSystems from "@/components/organisms/administration/AuthSystems.vue";
import GeneralSettings from "@/components/organisms/administration/GeneralSettings.vue";
import SchoolPolicy from "@/components/organisms/administration/SchoolPolicy.vue";
Expand All @@ -169,6 +168,7 @@ import {
SCHOOLS_MODULE_KEY,
} from "@/utils/inject";
import { buildPageTitle } from "@/utils/pageTitle";
import { mdiAlertCircle, mdiMinus, mdiPlus } from "@icons/material";
import { useTitle } from "@vueuse/core";
import { computed, ComputedRef, defineComponent, ref, Ref, watch } from "vue";
import { useI18n } from "vue-i18n";
Expand Down Expand Up @@ -239,13 +239,17 @@ export default defineComponent({
() => schoolsModule.getError
);
const isFeatureOauthMigrationEnabled: ComputedRef<boolean | undefined> =
computed(() => envConfigModule.getFeatureSchoolSanisUserMigrationEnabled);
computed(
() => envConfigModule.getEnv.FEATURE_USER_LOGIN_MIGRATION_ENABLED
);
const isFeatureSchoolPolicyEnabled: ComputedRef<boolean | undefined> =
computed(() => envConfigModule.getSchoolPolicyEnabled);
computed(() => envConfigModule.getEnv.FEATURE_SCHOOL_POLICY_ENABLED_NEW);
const isFeatureSchoolTermsOfUseEnabled: ComputedRef<boolean | undefined> =
computed(() => envConfigModule.getSchoolTermsOfUseEnabled);
computed(
() => 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
8 changes: 4 additions & 4 deletions src/pages/administration/StudentOverview.page.vue
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,8 @@ export default {
qrLinks: "getQrLinks",
registrationLinks: "getRegistrationLinks",
}),
getFeatureSchoolSanisUserMigrationEnabled() {
return envConfigModule.getFeatureSchoolSanisUserMigrationEnabled;
getFeatureUserLoginMigrationEnabled() {
return envConfigModule.getEnv.FEATURE_USER_LOGIN_MIGRATION_ENABLED;
},
schoolIsExternallyManaged() {
return schoolsModule.schoolIsExternallyManaged;
Expand Down Expand Up @@ -393,8 +393,8 @@ export default {
);
}

// filters out the lastLoginSystemChange and outdatedSince columns if FEATURE_SCHOOL_SANIS_USER_MIGRATION_ENABLED env is disabled
if (!this.getFeatureSchoolSanisUserMigrationEnabled) {
// filters out the lastLoginSystemChange and outdatedSince columns if FEATURE_USER_LOGIN_MIGRATION_ENABLED env is disabled
if (!this.getFeatureUserLoginMigrationEnabled) {
editedColumns = editedColumns
.filter((col) => col.field !== "lastLoginSystemChange")
.filter((col) => col.field !== "outdatedSince");
Expand Down
6 changes: 3 additions & 3 deletions src/pages/administration/TeacherOverview.page.vue
Original file line number Diff line number Diff line change
Expand Up @@ -324,8 +324,8 @@ export default {
schoolIsExternallyManaged() {
return schoolsModule.schoolIsExternallyManaged;
},
getFeatureSchoolSanisUserMigrationEnabled() {
return envConfigModule.getFeatureSchoolSanisUserMigrationEnabled;
getFeatureUserLoginMigrationEnabled() {
return envConfigModule.getEnv.FEATURE_USER_LOGIN_MIGRATION_ENABLED;
},
env() {
return envConfigModule.getEnv;
Expand Down Expand Up @@ -387,7 +387,7 @@ export default {
);
}

if (!this.getFeatureSchoolSanisUserMigrationEnabled) {
if (!this.getFeatureUserLoginMigrationEnabled) {
editedColumns = editedColumns
.filter((col) => col.field !== "lastLoginSystemChange")
.filter((col) => col.field !== "outdatedSince");
Expand Down
16 changes: 8 additions & 8 deletions src/pages/administration/student-overview.unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -372,33 +372,33 @@ describe("students/index", () => {
it("should display the columns behind the migration feature flag", () => {
const envBuild = envsFactory.build({
...envs,
FEATURE_SCHOOL_SANIS_USER_MIGRATION_ENABLED: true,
FEATURE_USER_LOGIN_MIGRATION_ENABLED: true,
});
envConfigModule.setEnvs(envBuild);
const { wrapper } = setup();
const column1 = wrapper.find(`[data-testid="lastLoginSystemChange"]`);
const column2 = wrapper.find(`[data-testid="outdatedSince"]`);

expect(
envConfigModule.getEnv.FEATURE_SCHOOL_SANIS_USER_MIGRATION_ENABLED
).toBe(true);
expect(envConfigModule.getEnv.FEATURE_USER_LOGIN_MIGRATION_ENABLED).toBe(
true
);
expect(column1.exists()).toBe(true);
expect(column2.exists()).toBe(true);
});

it("should not display the columns behind the migration feature flag", () => {
const envBuild = envsFactory.build({
...envs,
FEATURE_SCHOOL_SANIS_USER_MIGRATION_ENABLED: false,
FEATURE_USER_LOGIN_MIGRATION_ENABLED: false,
});
envConfigModule.setEnvs(envBuild);
const { wrapper } = setup();
const column1 = wrapper.find(`[data-testid="lastLoginSystemChange"]`);
const column2 = wrapper.find(`[data-testid="outdatedSince"]`);

expect(
envConfigModule.getEnv.FEATURE_SCHOOL_SANIS_USER_MIGRATION_ENABLED
).toBe(false);
expect(envConfigModule.getEnv.FEATURE_USER_LOGIN_MIGRATION_ENABLED).toBe(
false
);
expect(column1.exists()).toBe(false);
expect(column2.exists()).toBe(false);
});
Expand Down
16 changes: 8 additions & 8 deletions src/pages/administration/teacher-overview.unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -370,35 +370,35 @@ describe("teachers/index", () => {
it("should display the columns behind the migration feature flag", () => {
const envBuild = envsFactory.build({
...envs,
FEATURE_SCHOOL_SANIS_USER_MIGRATION_ENABLED: true,
FEATURE_USER_LOGIN_MIGRATION_ENABLED: true,
});
envConfigModule.setEnvs(envBuild);
const { wrapper } = setup();

const column1 = wrapper.find(`[data-testid="lastLoginSystemChange"]`);
const column2 = wrapper.find(`[data-testid="outdatedSince"]`);

expect(
envConfigModule.getEnv.FEATURE_SCHOOL_SANIS_USER_MIGRATION_ENABLED
).toBe(true);
expect(envConfigModule.getEnv.FEATURE_USER_LOGIN_MIGRATION_ENABLED).toBe(
true
);
expect(column1.exists()).toBe(true);
expect(column2.exists()).toBe(true);
});

it("should not display the columns behind the migration feature flag", () => {
const envBuild = envsFactory.build({
...envs,
FEATURE_SCHOOL_SANIS_USER_MIGRATION_ENABLED: false,
FEATURE_USER_LOGIN_MIGRATION_ENABLED: false,
});
envConfigModule.setEnvs(envBuild);
const { wrapper } = setup();

const column1 = wrapper.find(`[data-testid="lastLoginSystemChange"]`);
const column2 = wrapper.find(`[data-testid="outdatedSince"]`);

expect(
envConfigModule.getEnv.FEATURE_SCHOOL_SANIS_USER_MIGRATION_ENABLED
).toBe(false);
expect(envConfigModule.getEnv.FEATURE_USER_LOGIN_MIGRATION_ENABLED).toBe(
false
);
expect(column1.exists()).toBe(false);
expect(column2.exists()).toBe(false);
});
Expand Down
Loading
Loading