test(frontend): Coverage verbeteren
This commit is contained in:
parent
c47da0c826
commit
4a6b6ee061
10 changed files with 387 additions and 16 deletions
|
@ -1,19 +1,30 @@
|
|||
import { StudentController } from "../../src/controllers/students";
|
||||
import { expect, it, describe, afterAll, beforeAll } from "vitest";
|
||||
import { setup, teardown } from "../setup-backend.js";
|
||||
import { StudentController } from '../../src/controllers/students';
|
||||
import { beforeEach, describe, expect, it } from 'vitest';
|
||||
|
||||
describe("Test controller students", () => {
|
||||
beforeAll(async () => {
|
||||
await setup();
|
||||
describe('Test controller students', () => {
|
||||
let controller: StudentController;
|
||||
|
||||
beforeEach(async () => {
|
||||
controller = new StudentController();
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
await teardown();
|
||||
});
|
||||
|
||||
it("Get students", async () => {
|
||||
const controller = new StudentController();
|
||||
it('Get students', async () => {
|
||||
const data = await controller.getAll(true);
|
||||
expect(data.students).to.have.length.greaterThan(0);
|
||||
});
|
||||
|
||||
it('Get student by username', async () => {
|
||||
const username = 'testleerling1';
|
||||
const data = await controller.getByUsername(username);
|
||||
expect(data.student.username).to.equal(username);
|
||||
});
|
||||
|
||||
it('Get classes of student', async () => {
|
||||
const students = await controller.getAll(true);
|
||||
|
||||
for (const student of students.students) {
|
||||
const data = await controller.getClasses(student.username, true);
|
||||
expect(data.classes).to.have.length.greaterThan(0);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue