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

BC-8737 - Add missing tests (and more) for video conference feature #3501

Merged
merged 16 commits into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from 10 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
6 changes: 4 additions & 2 deletions src/locales/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1930,8 +1930,10 @@ export default {
"Die Videokonferenz wurde noch nicht gestartet.",
"pages.videoConference.info.notEnabledParticipants":
"Das Element ist nicht mehr verfügbar. Bitte an die Lehrkraft wenden.",
"pages.videoConference.info.notEnabledTeacher":
"Das Element ist nicht mehr verfügbar. Bitte an den Admin wenden.",
"pages.videoConference.info.courseParent.notEnabledTeacher":
"Das Element ist nicht mehr verfügbar, da Videokonferenzen deaktiviert wurden. Bitte in den Kurs-Einstellungen aktivieren und/oder an den Schul-Admin wenden.",
"pages.videoConference.info.roomParent.notEnabledTeacher":
"Das Element ist nicht mehr verfügbar, da Videokonferenzen für die Schule deaktiviert wurden. Bitte an den Schul-Admin wenden.",
"pages.videoConference.title": "Videokonferenz BigBlueButton",
"error.500":
"Es gibt Probleme im System. Wir arbeiten daran, das Problem zu beheben. Bitte später erneut versuchen.",
Expand Down
6 changes: 4 additions & 2 deletions src/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1897,8 +1897,10 @@ export default {
"The video conference hasn't started yet.",
"pages.videoConference.info.notEnabledParticipants":
"The element is no longer available. Please contact the teacher.",
"pages.videoConference.info.notEnabledTeacher":
"The element is no longer available. Please contact the admin.",
"pages.videoConference.info.courseParent.notEnabledTeacher":
"The element is no longer available as video conferencing has been deactivated. Please activate it in the course settings and/or contact the school admin.",
"pages.videoConference.info.roomParent.notEnabledTeacher":
"The element is no longer available as video conferencing has been disabled for the school. Please contact the school admin.",
"pages.videoConference.title": "Video conference BigBlueButton",
"error.500":
"There are problems in the system. We are working on fixing the issue. Please try again later.",
Expand Down
6 changes: 4 additions & 2 deletions src/locales/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1951,8 +1951,10 @@ export default {
"La videoconferencia aún no ha comenzado.",
"pages.videoConference.info.notEnabledParticipants":
"El elemento ya no está disponible. Póngase en contacto con el profesor.",
"pages.videoConference.info.notEnabledTeacher":
"El elemento ya no está disponible. Póngase en contacto con el administrador.",
"pages.videoConference.info.courseParent.notEnabledTeacher":
"El elemento ya no está disponible porque se ha desactivado la videoconferencia. Por favor, actívelo en los ajustes del curso y/o contacte con el administrador de la escuela.",
"pages.videoConference.info.roomParent.notEnabledTeacher":
"Este elemento ya no está disponible porque se ha desactivado la videoconferencia en la escuela. Póngase en contacto con el administrador de la escuela.",
"pages.videoConference.title": "Videoconferencia BigBlueButton",
"error.500":
"Hay problemas en el sistema. Estamos trabajando para solucionar el problema. Vuelva a intentarlo más tarde.",
Expand Down
6 changes: 4 additions & 2 deletions src/locales/uk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1923,8 +1923,10 @@ export default {
"pages.videoConference.info.notStarted": "Відеоконференція ще не почалася.",
"pages.videoConference.info.notEnabledParticipants":
"Елемент більше не доступний. Будь ласка, зверніться до викладача.",
"pages.videoConference.info.notEnabledTeacher":
"Елемент більше не доступний. Будь ласка, зверніться з адміністратором.",
"pages.videoConference.info.courseParent.notEnabledTeacher":
"Цей елемент більше не доступний, оскільки відеоконференції було вимкнено. Будь ласка, активуйте його в налаштуваннях курсу та/або зверніться до адміністратора школи.",
"pages.videoConference.info.roomParent.notEnabledTeacher":
"Цей елемент більше не доступний, оскільки відеоконференції в школі вимкнено. Будь ласка, зверніться до адміністратора школи.",
"pages.videoConference.title": "Відеоконференція BigBlueButton",
"error.500":
"Є проблеми в системі. Ми працюємо над усуненням проблеми. Будь ласка, спробуйте пізніше.",
Expand Down
3 changes: 1 addition & 2 deletions src/modules/data/board/Board.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import { createApplicationError } from "@/utils/create-application-error.factory
import { HttpStatusCode } from "@/store/types/http-status-code.enum";
import { useRouter } from "vue-router";
import { useI18n } from "vue-i18n";
import { BoardFeature } from "@/serverApi/v3";

export const useBoardStore = defineStore("boardStore", () => {
const cardStore = useCardStore();
Expand Down Expand Up @@ -364,7 +363,7 @@ export const useBoardStore = defineStore("boardStore", () => {
: board.value.columns[columnIndex - 1].id;
};

const getFeatures = computed((): BoardFeature[] | [] => {
const getFeatures = computed(() => {
if (!board.value) return [];

return board.value.features;
Expand Down
2 changes: 1 addition & 1 deletion src/modules/data/board/BoardFeatures.composable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useBoardStore } from "@data-board";
export const useBoardFeatures = () => {
const { getFeatures } = useBoardStore();

const features: BoardFeature[] = getFeatures;
const features = getFeatures;

const isFeatureEnabled = (feature: BoardFeature) => {
return features.includes(feature);
Expand Down
34 changes: 34 additions & 0 deletions src/modules/data/board/BoardFeatures.composable.unit.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { BoardFeature } from "@/serverApi/v3";
import { mountComposable } from "@@/tests/test-utils";
import { useBoardFeatures } from "./BoardFeatures.composable";
import { useBoardStore } from "./Board.store";
import { createMock } from "@golevelup/ts-jest";

jest.mock("./Board.store");
const mockedUseBoardStore = jest.mocked(useBoardStore);

describe("useBoardFeatures", () => {
const setup = (props: BoardFeature[] | []) => {
const mockedUseBoardStoreFeatures = createMock<
ReturnType<typeof useBoardStore>
>({
getFeatures: props,
});
mockedUseBoardStore.mockReturnValue(mockedUseBoardStoreFeatures);
return mountComposable(() => useBoardFeatures(), {});
};

it("should determine if a feature is enabled", () => {
MartinSchuhmacher marked this conversation as resolved.
Show resolved Hide resolved
const { isFeatureEnabled } = setup([BoardFeature.Videoconference]);

const result = isFeatureEnabled(BoardFeature.Videoconference);
expect(result).toBe(true);
});

it("should return false when no features are present", () => {
const { isFeatureEnabled } = setup([]);

const result = isFeatureEnabled(BoardFeature.Videoconference);
expect(result).toBe(false);
});
});
Loading
Loading