style: fix linting issues met Prettier
This commit is contained in:
parent
1b18338c78
commit
ba617a43e7
11 changed files with 46 additions and 30 deletions
|
@ -17,7 +17,7 @@ export async function initORM(testingMode = false): Promise<MikroORM<IDatabaseDr
|
||||||
|
|
||||||
// Update the database scheme if necessary and enabled.
|
// Update the database scheme if necessary and enabled.
|
||||||
if (getEnvVar(envVars.DbUpdate)) {
|
if (getEnvVar(envVars.DbUpdate)) {
|
||||||
logger.info("MikroORM: Updating database schema");
|
logger.info('MikroORM: Updating database schema');
|
||||||
await orm.schema.updateSchema();
|
await orm.schema.updateSchema();
|
||||||
} else {
|
} else {
|
||||||
const diff = await orm.schema.getUpdateSchemaSQL();
|
const diff = await orm.schema.getUpdateSchemaSQL();
|
||||||
|
|
|
@ -29,7 +29,11 @@ describe('SubmissionRepository', () => {
|
||||||
|
|
||||||
it('should find the requested submission', async () => {
|
it('should find the requested submission', async () => {
|
||||||
const usedSubmission = getSubmission01();
|
const usedSubmission = getSubmission01();
|
||||||
const id = new LearningObjectIdentifier(usedSubmission.learningObjectHruid, usedSubmission.learningObjectLanguage, usedSubmission.learningObjectVersion);
|
const id = new LearningObjectIdentifier(
|
||||||
|
usedSubmission.learningObjectHruid,
|
||||||
|
usedSubmission.learningObjectLanguage,
|
||||||
|
usedSubmission.learningObjectVersion
|
||||||
|
);
|
||||||
const submission = await submissionRepository.findSubmissionByLearningObjectAndSubmissionNumber(id, usedSubmission.submissionNumber!);
|
const submission = await submissionRepository.findSubmissionByLearningObjectAndSubmissionNumber(id, usedSubmission.submissionNumber!);
|
||||||
|
|
||||||
expect(submission).toBeTruthy();
|
expect(submission).toBeTruthy();
|
||||||
|
@ -40,7 +44,11 @@ describe('SubmissionRepository', () => {
|
||||||
|
|
||||||
it('should find the most recent submission for a student', async () => {
|
it('should find the most recent submission for a student', async () => {
|
||||||
const usedSubmission = getSubmission02();
|
const usedSubmission = getSubmission02();
|
||||||
const id = new LearningObjectIdentifier(usedSubmission.learningObjectHruid, usedSubmission.learningObjectLanguage, usedSubmission.learningObjectVersion);
|
const id = new LearningObjectIdentifier(
|
||||||
|
usedSubmission.learningObjectHruid,
|
||||||
|
usedSubmission.learningObjectLanguage,
|
||||||
|
usedSubmission.learningObjectVersion
|
||||||
|
);
|
||||||
|
|
||||||
const submission = await submissionRepository.findMostRecentSubmissionForStudent(id, usedSubmission.submitter);
|
const submission = await submissionRepository.findMostRecentSubmissionForStudent(id, usedSubmission.submitter);
|
||||||
|
|
||||||
|
@ -50,7 +58,11 @@ describe('SubmissionRepository', () => {
|
||||||
|
|
||||||
it('should find the most recent submission for a group', async () => {
|
it('should find the most recent submission for a group', async () => {
|
||||||
const usedSubmission = getSubmission02();
|
const usedSubmission = getSubmission02();
|
||||||
const id = new LearningObjectIdentifier(usedSubmission.learningObjectHruid, usedSubmission.learningObjectLanguage, usedSubmission.learningObjectVersion);
|
const id = new LearningObjectIdentifier(
|
||||||
|
usedSubmission.learningObjectHruid,
|
||||||
|
usedSubmission.learningObjectLanguage,
|
||||||
|
usedSubmission.learningObjectVersion
|
||||||
|
);
|
||||||
|
|
||||||
const submission = await submissionRepository.findMostRecentSubmissionForGroup(id, usedSubmission.onBehalfOf);
|
const submission = await submissionRepository.findMostRecentSubmissionForGroup(id, usedSubmission.onBehalfOf);
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,6 @@ describe('ClassRepository', () => {
|
||||||
expect(invitations).toHaveLength(2);
|
expect(invitations).toHaveLength(2);
|
||||||
expect(invitations[0].class.classId).toBeOneOf([ti1.class.classId, ti2.class.classId]);
|
expect(invitations[0].class.classId).toBeOneOf([ti1.class.classId, ti2.class.classId]);
|
||||||
expect(invitations[1].class.classId).toBeOneOf([ti1.class.classId, ti2.class.classId]);
|
expect(invitations[1].class.classId).toBeOneOf([ti1.class.classId, ti2.class.classId]);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not find a removed invitation', async () => {
|
it('should not find a removed invitation', async () => {
|
||||||
|
|
|
@ -49,8 +49,6 @@ describe('LearningObjectRepository', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return the newest version of the learning object when queried by only hruid and language', async () => {
|
it('should return the newest version of the learning object when queried by only hruid and language', async () => {
|
||||||
|
|
||||||
|
|
||||||
const result = await learningObjectRepository.findLatestByHruidAndLanguage(newerExample.hruid, newerExample.language);
|
const result = await learningObjectRepository.findLatestByHruidAndLanguage(newerExample.hruid, newerExample.language);
|
||||||
// Expect(result).toBeInstanceOf(LearningObject);
|
// Expect(result).toBeInstanceOf(LearningObject);
|
||||||
// Expect(result?.version).toBe(10);
|
// Expect(result?.version).toBe(10);
|
||||||
|
|
|
@ -106,34 +106,34 @@ let submission06: Submission;
|
||||||
let submission07: Submission;
|
let submission07: Submission;
|
||||||
let submission08: Submission;
|
let submission08: Submission;
|
||||||
|
|
||||||
export function getSubmission01(): Submission{
|
export function getSubmission01(): Submission {
|
||||||
return submission01;
|
return submission01;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getSubmission02(): Submission{
|
export function getSubmission02(): Submission {
|
||||||
return submission02;
|
return submission02;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getSubmission03(): Submission{
|
export function getSubmission03(): Submission {
|
||||||
return submission03;
|
return submission03;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getSubmission04(): Submission{
|
export function getSubmission04(): Submission {
|
||||||
return submission04;
|
return submission04;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getSubmission05(): Submission{
|
export function getSubmission05(): Submission {
|
||||||
return submission05;
|
return submission05;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getSubmission06(): Submission{
|
export function getSubmission06(): Submission {
|
||||||
return submission06;
|
return submission06;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getSubmission07(): Submission{
|
export function getSubmission07(): Submission {
|
||||||
return submission07;
|
return submission07;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getSubmission08(): Submission{
|
export function getSubmission08(): Submission {
|
||||||
return submission08;
|
return submission08;
|
||||||
}
|
}
|
|
@ -37,18 +37,18 @@ let classJoinRequest02: ClassJoinRequest;
|
||||||
let classJoinRequest03: ClassJoinRequest;
|
let classJoinRequest03: ClassJoinRequest;
|
||||||
let classJoinRequest04: ClassJoinRequest;
|
let classJoinRequest04: ClassJoinRequest;
|
||||||
|
|
||||||
export function getClassJoinRequest01(): ClassJoinRequest{
|
export function getClassJoinRequest01(): ClassJoinRequest {
|
||||||
return classJoinRequest01;
|
return classJoinRequest01;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getClassJoinRequest02(): ClassJoinRequest{
|
export function getClassJoinRequest02(): ClassJoinRequest {
|
||||||
return classJoinRequest02;
|
return classJoinRequest02;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getClassJoinRequest03(): ClassJoinRequest{
|
export function getClassJoinRequest03(): ClassJoinRequest {
|
||||||
return classJoinRequest03;
|
return classJoinRequest03;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getClassJoinRequest04(): ClassJoinRequest{
|
export function getClassJoinRequest04(): ClassJoinRequest {
|
||||||
return classJoinRequest04;
|
return classJoinRequest04;
|
||||||
}
|
}
|
|
@ -19,6 +19,6 @@ export function makeTestAttachments(em: EntityManager): Attachment[] {
|
||||||
|
|
||||||
let attachment01: Attachment;
|
let attachment01: Attachment;
|
||||||
|
|
||||||
export function getAttachment01(): Attachment{
|
export function getAttachment01(): Attachment {
|
||||||
return attachment01;
|
return attachment01;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,12 @@
|
||||||
import { EntityManager } from '@mikro-orm/core';
|
import { EntityManager } from '@mikro-orm/core';
|
||||||
import { Question } from '../../../src/entities/questions/question.entity';
|
import { Question } from '../../../src/entities/questions/question.entity';
|
||||||
import { getDireStraits, getNoordkaap, getTestleerling1, getTool } from '../users/students.testdata';
|
import { getDireStraits, getNoordkaap, getTestleerling1, getTool } from '../users/students.testdata';
|
||||||
import { testLearningObject01, testLearningObject04, testLearningObject05, testLearningObjectMultipleChoice } from '../content/learning-objects.testdata';
|
import {
|
||||||
|
testLearningObject01,
|
||||||
|
testLearningObject04,
|
||||||
|
testLearningObject05,
|
||||||
|
testLearningObjectMultipleChoice,
|
||||||
|
} from '../content/learning-objects.testdata';
|
||||||
import { getGroup1ConditionalLearningPath, getTestGroup01, getTestGroup02 } from '../assignments/groups.testdata';
|
import { getGroup1ConditionalLearningPath, getTestGroup01, getTestGroup02 } from '../assignments/groups.testdata';
|
||||||
|
|
||||||
export function makeTestQuestions(em: EntityManager): Question[] {
|
export function makeTestQuestions(em: EntityManager): Question[] {
|
||||||
|
@ -130,7 +135,6 @@ export function getQuestion06(): Question {
|
||||||
return question06;
|
return question06;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export function getQuestion07(): Question {
|
export function getQuestion07(): Question {
|
||||||
return question07;
|
return question07;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,10 @@ import { seedORM } from './seedORM.js';
|
||||||
|
|
||||||
const logger: Logger = getLogger();
|
const logger: Logger = getLogger();
|
||||||
|
|
||||||
export async function seedDatabase(envFile = '.env.development.local', testMode = process.env.NODE_ENV !== undefined && process.env.NODE_ENV === 'test'): Promise<void> {
|
export async function seedDatabase(
|
||||||
|
envFile = '.env.development.local',
|
||||||
|
testMode = process.env.NODE_ENV !== undefined && process.env.NODE_ENV === 'test'
|
||||||
|
): Promise<void> {
|
||||||
dotenv.config({ path: envFile });
|
dotenv.config({ path: envFile });
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue