style: fix linting issues met Prettier

This commit is contained in:
Lint Action 2025-03-13 08:36:15 +00:00
parent 0e2f9e5359
commit 3d3bf6dba4

View file

@ -1,7 +1,7 @@
import {describe, it, expect, vi} from 'vitest'; import { describe, it, expect, vi } from 'vitest';
import {fetchLearningPaths, searchLearningPaths} from '../../src/services/learningPaths'; import { fetchLearningPaths, searchLearningPaths } from '../../src/services/learningPaths';
import {fetchWithLogging} from '../../src/util/apiHelper'; import { fetchWithLogging } from '../../src/util/apiHelper';
import {LearningPathResponse} from '../../src/interfaces/learningPath'; import { LearningPathResponse } from '../../src/interfaces/learningPath';
// Mock the fetchWithLogging module using vi // Mock the fetchWithLogging module using vi
vi.mock('../../src/util/apiHelper', () => ({ vi.mock('../../src/util/apiHelper', () => ({
@ -13,7 +13,7 @@ describe('fetchLearningPaths', () => {
const mockHruids = ['pn_werking', 'art1']; const mockHruids = ['pn_werking', 'art1'];
const language = 'en'; const language = 'en';
const source = 'Test Source'; const source = 'Test Source';
const mockResponse = [{title: 'Test Path', hruids: mockHruids}]; const mockResponse = [{ title: 'Test Path', hruids: mockHruids }];
it('✅ Should return a successful response when HRUIDs are provided', async () => { it('✅ Should return a successful response when HRUIDs are provided', async () => {
// Mock the function to return mockResponse // Mock the function to return mockResponse
@ -49,27 +49,28 @@ describe('fetchLearningPaths', () => {
}); });
describe('searchLearningPaths', () => { describe('searchLearningPaths', () => {
const query = 'https://dwengo.org/backend/api/learningPath/getPathsFromIdList?pathIdList=%7B%22hruids%22:%5B%22pn_werking%22,%22un_artificiele_intelligentie%22%5D%7D&language=nl'; const query =
'https://dwengo.org/backend/api/learningPath/getPathsFromIdList?pathIdList=%7B%22hruids%22:%5B%22pn_werking%22,%22un_artificiele_intelligentie%22%5D%7D&language=nl';
const language = 'nl'; const language = 'nl';
it('✅ Should return search results when API responds with data', async () => { it('✅ Should return search results when API responds with data', async () => {
const mockResults = [
{
const mockResults = [{ _id: '67b4488c9dadb305c4104618',
_id: '67b4488c9dadb305c4104618', language: 'nl',
language: 'nl', hruid: 'pn_werking',
hruid: 'pn_werking', title: 'Werken met notebooks',
title: 'Werken met notebooks', description: 'Een korte inleiding tot Python notebooks. Hoe ga je gemakkelijk en efficiënt met de notebooks aan de slag?',
description: 'Een korte inleiding tot Python notebooks. Hoe ga je gemakkelijk en efficiënt met de notebooks aan de slag?', num_nodes: 0,
num_nodes: 0, num_nodes_left: 0,
num_nodes_left: 0, nodes: [],
nodes: [], keywords: 'Python KIKS Wiskunde STEM AI',
keywords: 'Python KIKS Wiskunde STEM AI', target_ages: [14, 15, 16, 17, 18],
target_ages: [14, 15, 16, 17, 18], min_age: 14,
min_age: 14, max_age: 18,
max_age: 18, __order: 0,
__order: 0 },
}]; ];
// Mock fetchWithLogging to return search results // Mock fetchWithLogging to return search results
vi.mocked(fetchWithLogging).mockResolvedValue(mockResults); vi.mocked(fetchWithLogging).mockResolvedValue(mockResults);