style: fix linting issues met Prettier

This commit is contained in:
Lint Action 2025-03-11 04:08:12 +00:00
parent b630b9a45d
commit 466b9b8d17

View file

@ -1,14 +1,14 @@
import {beforeAll, describe, expect, it} from 'vitest';
import {setupTestApp} from '../../setup-tests';
import {LearningObject} from '../../../src/entities/content/learning-object.entity';
import {getLearningObjectRepository, getLearningPathRepository} from '../../../src/data/repositories';
import { beforeAll, describe, expect, it } from 'vitest';
import { setupTestApp } from '../../setup-tests';
import { LearningObject } from '../../../src/entities/content/learning-object.entity';
import { getLearningObjectRepository, getLearningPathRepository } from '../../../src/data/repositories';
import learningObjectExample from '../../test-assets/learning-objects/pn-werkingnotebooks/pn-werkingnotebooks-example';
import learningObjectService from '../../../src/services/learning-objects/learning-object-service';
import {LearningObjectIdentifier, LearningPathIdentifier} from '../../../src/interfaces/learning-content';
import {Language} from '../../../src/entities/content/language';
import {EnvVars, getEnvVar} from '../../../src/util/envvars';
import {LearningPath} from "../../../src/entities/content/learning-path.entity";
import learningPathExample from "../../test-assets/learning-paths/pn-werking-example";
import { LearningObjectIdentifier, LearningPathIdentifier } from '../../../src/interfaces/learning-content';
import { Language } from '../../../src/entities/content/language';
import { EnvVars, getEnvVar } from '../../../src/util/envvars';
import { LearningPath } from '../../../src/entities/content/learning-path.entity';
import learningPathExample from '../../test-assets/learning-paths/pn-werking-example';
const TEST_LEARNING_OBJECT_TITLE = 'Test title';
const EXPECTED_DWENGO_LEARNING_OBJECT_TITLE = 'Werken met notebooks';
@ -20,9 +20,9 @@ const DWENGO_TEST_LEARNING_OBJECT_ID: LearningObjectIdentifier = {
const DWENGO_TEST_LEARNING_PATH_ID: LearningPathIdentifier = {
hruid: 'pn_werking',
language: Language.Dutch
language: Language.Dutch,
};
const DWENGO_TEST_LEARNING_PATH_HRUIDS = new Set(["pn_werkingnotebooks", "pn_werkingnotebooks2", "pn_werkingnotebooks3"]);
const DWENGO_TEST_LEARNING_PATH_HRUIDS = new Set(['pn_werkingnotebooks', 'pn_werkingnotebooks2', 'pn_werkingnotebooks3']);
async function initExampleData(): Promise<{ learningObject: LearningObject; learningPath: LearningPath }> {
const learningObjectRepo = getLearningObjectRepository();
@ -95,31 +95,31 @@ describe('LearningObjectService', () => {
});
describe('getLearningObjectsFromPath', () => {
it("returns all learning objects when a learning path in the database is queried", async () => {
it('returns all learning objects when a learning path in the database is queried', async () => {
const result = await learningObjectService.getLearningObjectsFromPath(exampleLearningPath);
expect(result.map(it => it.key)).toEqual(exampleLearningPath.nodes.map(it => it.learningObjectHruid));
expect(result.map((it) => it.key)).toEqual(exampleLearningPath.nodes.map((it) => it.learningObjectHruid));
});
it("also returns all learning objects when a learning path from the Dwengo API is queried", async () => {
it('also returns all learning objects when a learning path from the Dwengo API is queried', async () => {
const result = await learningObjectService.getLearningObjectsFromPath(DWENGO_TEST_LEARNING_PATH_ID);
expect(new Set(result.map(it => it.key))).toEqual(DWENGO_TEST_LEARNING_PATH_HRUIDS);
expect(new Set(result.map((it) => it.key))).toEqual(DWENGO_TEST_LEARNING_PATH_HRUIDS);
});
it("returns an empty list when queried with a non-existing learning path id", async () => {
const result = await learningObjectService.getLearningObjectsFromPath({hruid: "non_existing", language: Language.Dutch});
it('returns an empty list when queried with a non-existing learning path id', async () => {
const result = await learningObjectService.getLearningObjectsFromPath({ hruid: 'non_existing', language: Language.Dutch });
expect(result).toEqual([]);
});
});
describe('getLearningObjectIdsFromPath', () => {
it("returns all learning objects when a learning path in the database is queried", async () => {
it('returns all learning objects when a learning path in the database is queried', async () => {
const result = await learningObjectService.getLearningObjectIdsFromPath(exampleLearningPath);
expect(result).toEqual(exampleLearningPath.nodes.map(it => it.learningObjectHruid));
expect(result).toEqual(exampleLearningPath.nodes.map((it) => it.learningObjectHruid));
});
it("also returns all learning object hruids when a learning path from the Dwengo API is queried", async () => {
it('also returns all learning object hruids when a learning path from the Dwengo API is queried', async () => {
const result = await learningObjectService.getLearningObjectIdsFromPath(DWENGO_TEST_LEARNING_PATH_ID);
expect(new Set(result)).toEqual(DWENGO_TEST_LEARNING_PATH_HRUIDS);
});
it("returns an empty list when queried with a non-existing learning path id", async () => {
const result = await learningObjectService.getLearningObjectIdsFromPath({hruid: "non_existing", language: Language.Dutch});
it('returns an empty list when queried with a non-existing learning path id', async () => {
const result = await learningObjectService.getLearningObjectIdsFromPath({ hruid: 'non_existing', language: Language.Dutch });
expect(result).toEqual([]);
});
});