fix(backend): Probleem opgelost dat meerdere studenten en leerkrachten met dezelfde PK opgeslagen konden worden.
create() en insert() i.p.v. entity constructoren en persist() gebruikt.
This commit is contained in:
parent
295fe23e99
commit
bc94b25a6a
8 changed files with 18 additions and 36 deletions
|
@ -1,5 +1,4 @@
|
|||
import { setupTestApp } from '../../setup-tests.js';
|
||||
import { Student } from '../../../src/entities/users/student.entity.js';
|
||||
import { describe, it, expect, beforeAll } from 'vitest';
|
||||
import { StudentRepository } from '../../../src/data/users/student-repository.js';
|
||||
import { getStudentRepository } from '../../../src/data/repositories.js';
|
||||
|
@ -30,7 +29,7 @@ describe('StudentRepository', () => {
|
|||
});
|
||||
|
||||
it('should return the queried student after he was added', async () => {
|
||||
await studentRepository.insert(new Student(username, firstName, lastName));
|
||||
await studentRepository.insert(studentRepository.create({username, firstName, lastName}));
|
||||
|
||||
const retrievedStudent = await studentRepository.findByUsername(username);
|
||||
expect(retrievedStudent).toBeTruthy();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue