diff --git a/backend/tests/data/users/teachers.test.ts b/backend/tests/data/users/teachers.test.ts index 62ad6d81..6ac59df0 100644 --- a/backend/tests/data/users/teachers.test.ts +++ b/backend/tests/data/users/teachers.test.ts @@ -2,6 +2,7 @@ import { describe, it, expect, beforeAll } from 'vitest'; import { TeacherRepository } from '../../../src/data/users/teacher-repository'; import { setupTestApp } from '../../setup-tests'; import { getTeacherRepository } from '../../../src/data/repositories'; +import { getFooFighters } from '../../test_assets/users/teachers.testdata'; const username = 'testteacher'; const firstName = 'John'; @@ -21,11 +22,12 @@ describe('TeacherRepository', () => { }); it('should return teacher from the datbase', async () => { - const teacher = await teacherRepository.findByUsername('FooFighters'); + const expected = getFooFighters(); + const teacher = await teacherRepository.findByUsername(expected.username); expect(teacher).toBeTruthy(); - expect(teacher?.firstName).toBe('Dave'); - expect(teacher?.lastName).toBe('Grohl'); + expect(teacher?.firstName).toBe(expected.firstName); + expect(teacher?.lastName).toBe(expected.lastName); }); it('should return the queried teacher after he was added', async () => { @@ -38,9 +40,9 @@ describe('TeacherRepository', () => { }); it('should no longer return the queried teacher after he was removed again', async () => { - await teacherRepository.deleteByUsername('ZesdeMetaal'); + await teacherRepository.deleteByUsername(username); - const retrievedTeacher = await teacherRepository.findByUsername('ZesdeMetaal'); + const retrievedTeacher = await teacherRepository.findByUsername(username); expect(retrievedTeacher).toBeNull(); }); });