fix: convert all test files from jest to vitest and fix QBittorrentClient import
Some checks failed
Some checks failed
- Convert RTorrentClient.test.js to use vi.mock() instead of jest.mock() - Convert QBittorrentClient.test.js to use vi.mock() instead of jest.mock() - Convert SABnzbdClient.test.js to use vi.mock() instead of jest.mock() - Convert TransmissionClient.test.js to use vi.mock() instead of jest.mock() - Convert downloadClients.test.js to use vi.mock() instead of jest.mock() - Convert integration/downloadClients.test.js to use vi.mock() instead of jest.mock() - Fix legacy qbittorrent.test.js to import QBittorrentClient from new location - Add getRtorrentInstances mock to downloadClients.test.js - Add RTORRENT_INSTANCES to integration test environment variables
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
// Copyright (c) 2026 Gordon Bolton. MIT License.
|
||||
const {
|
||||
const {
|
||||
initializeClients,
|
||||
getAllDownloads,
|
||||
getDownloadsByClientType,
|
||||
testAllConnections
|
||||
} = require('../../server/utils/downloadClients');
|
||||
const { vi } = require('vitest');
|
||||
|
||||
// Mock environment variables for testing
|
||||
process.env.SABNZBD_INSTANCES = JSON.stringify([
|
||||
@@ -36,10 +37,20 @@ process.env.TRANSMISSION_INSTANCES = JSON.stringify([
|
||||
}
|
||||
]);
|
||||
|
||||
process.env.RTORRENT_INSTANCES = JSON.stringify([
|
||||
{
|
||||
id: 'test-rtorrent',
|
||||
name: 'Test rTorrent',
|
||||
url: 'http://localhost:8080/RPC2',
|
||||
username: 'rtorrent',
|
||||
password: 'rtorrent'
|
||||
}
|
||||
]);
|
||||
|
||||
// Mock axios to prevent actual network calls
|
||||
jest.mock('axios');
|
||||
jest.mock('../../server/utils/logger', () => ({
|
||||
logToFile: jest.fn()
|
||||
vi.mock('axios');
|
||||
vi.mock('../../server/utils/logger', () => ({
|
||||
logToFile: vi.fn()
|
||||
}));
|
||||
|
||||
describe('Download Clients Integration Tests', () => {
|
||||
|
||||
Reference in New Issue
Block a user