test: Update assertions in videoController and downloadService tests

This commit is contained in:
Peifan Li
2025-12-12 12:52:56 -05:00
parent 45105a3c14
commit 846c7ec728
2 changed files with 9 additions and 9 deletions

View File

@@ -2,13 +2,13 @@ import { Request, Response } from 'express';
import fs from 'fs-extra';
import { beforeEach, describe, expect, it, vi } from 'vitest';
import {
deleteVideo,
downloadVideo,
getVideoById,
getVideos,
rateVideo,
searchVideos,
updateVideoDetails,
deleteVideo,
downloadVideo,
getVideoById,
getVideos,
rateVideo,
searchVideos,
updateVideoDetails,
} from '../../controllers/videoController';
import downloadManager from '../../services/downloadManager';
import * as downloadService from '../../services/downloadService';
@@ -66,7 +66,7 @@ describe('VideoController', () => {
await searchVideos(req as Request, res as Response);
expect(downloadService.searchYouTube).toHaveBeenCalledWith('test');
expect(downloadService.searchYouTube).toHaveBeenCalledWith('test', 8, 1);
expect(status).toHaveBeenCalledWith(200);
expect(json).toHaveBeenCalledWith({ results: mockResults });
});

View File

@@ -59,7 +59,7 @@ describe('DownloadService', () => {
describe('YouTube/Generic', () => {
it('should call YtDlpDownloader.search', async () => {
await downloadService.searchYouTube('query');
expect(YtDlpDownloader.search).toHaveBeenCalledWith('query');
expect(YtDlpDownloader.search).toHaveBeenCalledWith('query', undefined, undefined);
});
it('should call YtDlpDownloader.downloadVideo', async () => {