fix(backend): Workaround voor autoincrement-problemen bij SQLite
SQLite (die we voor de automatische tests gebruiken) ondersteunt geen autoincrement op kolommen die deel uitmaken van een composite primary key. Hiervoor heb ik een workaround geïmplementeerd.
This commit is contained in:
parent
678ced55ba
commit
4dcd4671ca
9 changed files with 94 additions and 42 deletions
|
@ -10,7 +10,6 @@ import { StudentRepository } from '../../../src/data/users/student-repository';
|
|||
import { LearningObjectRepository } from '../../../src/data/content/learning-object-repository';
|
||||
import { LearningObjectIdentifier } from '../../../src/entities/content/learning-object-identifier';
|
||||
import { Language } from '../../../src/entities/content/language';
|
||||
import { Question } from '../../../src/entities/questions/question.entity';
|
||||
|
||||
describe('QuestionRepository', () => {
|
||||
let questionRepository: QuestionRepository;
|
||||
|
@ -33,20 +32,20 @@ describe('QuestionRepository', () => {
|
|||
expect(questions).toHaveLength(2);
|
||||
});
|
||||
|
||||
// it('should create new question', async () => {
|
||||
// const id = new LearningObjectIdentifier('id03', Language.English, '1');
|
||||
// const student = await studentRepository.findByUsername('Noordkaap');
|
||||
// await questionRepository.createQuestion({
|
||||
// loId: id,
|
||||
// author: student!,
|
||||
// content: 'question?',
|
||||
// });
|
||||
// const question =
|
||||
// await questionRepository.findAllQuestionsAboutLearningObject(id);
|
||||
it('should create new question', async () => {
|
||||
const id = new LearningObjectIdentifier('id03', Language.English, '1');
|
||||
const student = await studentRepository.findByUsername('Noordkaap');
|
||||
await questionRepository.createQuestion({
|
||||
loId: id,
|
||||
author: student!,
|
||||
content: 'question?',
|
||||
});
|
||||
const question =
|
||||
await questionRepository.findAllQuestionsAboutLearningObject(id);
|
||||
|
||||
// expect(question).toBeTruthy();
|
||||
// expect(question).toHaveLength(1);
|
||||
// });
|
||||
expect(question).toBeTruthy();
|
||||
expect(question).toHaveLength(1);
|
||||
});
|
||||
|
||||
it('should not find removed question', async () => {
|
||||
const id = new LearningObjectIdentifier('id04', Language.English, '1');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue