refactor: tests class ids naar kleinere zonder hardcoding

This commit is contained in:
Gabriellvl 2025-05-04 13:52:23 +02:00
parent 81e0af28cc
commit 9643e25aed
15 changed files with 100 additions and 37 deletions

View file

@ -1,11 +1,12 @@
import { describe, it, expect, beforeEach } from "vitest";
import { AssignmentController } from "../../src/controllers/assignments";
import {getClass01} from "@dwengo-1/backend/tests/test_assets/classes/classes.testdata";
describe("AssignmentController Tests", () => {
let controller: AssignmentController;
beforeEach(() => {
controller = new AssignmentController("8764b861-90a6-42e5-9732-c0d9eb2f55f9"); // Example class ID
controller = new AssignmentController(getClass01().classId); // Example class ID
});
it("should fetch all assignments", async () => {

View file

@ -1,9 +1,10 @@
import { describe, expect, it } from "vitest";
import { GroupController } from "../../src/controllers/groups";
import {getClass01} from "@dwengo-1/backend/tests/test_assets/classes/classes.testdata";
describe("Test controller groups", () => {
it("Get groups", async () => {
const classId = "8764b861-90a6-42e5-9732-c0d9eb2f55f9";
const classId = getClass01().classId;
const assignmentNumber = 21000;
const controller = new GroupController(classId, assignmentNumber);

View file

@ -1,11 +1,12 @@
import { describe, expect, it } from "vitest";
import { SubmissionController } from "../../src/controllers/submissions";
import { Language } from "../../src/data-objects/language";
import {getClass01} from "@dwengo-1/backend/tests/test_assets/classes/classes.testdata";
describe("Test controller submissions", () => {
it("Get submission by number", async () => {
const hruid = "id03";
const classId = "8764b861-90a6-42e5-9732-c0d9eb2f55f9";
const classId = getClass01().classId;
const controller = new SubmissionController(hruid);
const data = await controller.getByNumber(Language.English, 1, classId, 1, 1, 1);