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,13 +1,14 @@
|
||||
// Copyright (c) 2026 Gordon Bolton. MIT License.
|
||||
const RTorrentClient = require('../../../server/clients/RTorrentClient');
|
||||
const xmlrpc = require('xmlrpc');
|
||||
const { vi } = require('vitest');
|
||||
|
||||
jest.mock('xmlrpc', () => ({
|
||||
createClient: jest.fn()
|
||||
vi.mock('xmlrpc', () => ({
|
||||
createClient: vi.fn()
|
||||
}));
|
||||
|
||||
jest.mock('../../../server/utils/logger', () => ({
|
||||
logToFile: jest.fn()
|
||||
vi.mock('../../../server/utils/logger', () => ({
|
||||
logToFile: vi.fn()
|
||||
}));
|
||||
|
||||
describe('RTorrentClient', () => {
|
||||
@@ -16,7 +17,7 @@ describe('RTorrentClient', () => {
|
||||
let mockMethodCall;
|
||||
|
||||
beforeEach(() => {
|
||||
mockMethodCall = jest.fn();
|
||||
mockMethodCall = vi.fn();
|
||||
xmlrpc.createClient.mockReturnValue({
|
||||
methodCall: mockMethodCall
|
||||
});
|
||||
@@ -30,7 +31,7 @@ describe('RTorrentClient', () => {
|
||||
};
|
||||
|
||||
client = new RTorrentClient(mockConfig);
|
||||
jest.clearAllMocks();
|
||||
vi.clearAllMocks();
|
||||
});
|
||||
|
||||
describe('Constructor', () => {
|
||||
|
||||
Reference in New Issue
Block a user