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

@ -2,6 +2,7 @@ import { beforeAll, describe, expect, it } from 'vitest';
import { ClassRepository } from '../../../src/data/classes/class-repository';
import { setupTestApp } from '../../setup-tests';
import { getClassRepository } from '../../../src/data/repositories';
import {getClass01, getClass04} from "../../test_assets/classes/classes.testdata";
describe('ClassRepository', () => {
let classRepository: ClassRepository;
@ -18,16 +19,16 @@ describe('ClassRepository', () => {
});
it('should return requested class', async () => {
const classVar = await classRepository.findById('8764b861-90a6-42e5-9732-c0d9eb2f55f9');
const classVar = await classRepository.findById(getClass01().classId);
expect(classVar).toBeTruthy();
expect(classVar?.displayName).toBe('class01');
});
it('class should be gone after deletion', async () => {
await classRepository.deleteById('33d03536-83b8-4880-9982-9bbf2f908ddf');
await classRepository.deleteById(getClass04().classId);
const classVar = await classRepository.findById('33d03536-83b8-4880-9982-9bbf2f908ddf');
const classVar = await classRepository.findById(getClass04().classId);
expect(classVar).toBeNull();
});