mirror of
https://github.com/RayLabsHQ/gitea-mirror.git
synced 2025-12-06 03:26:44 +03:00
test fix
This commit is contained in:
@@ -38,17 +38,27 @@ import { repoStatusEnum } from "@/types/Repository";
|
||||
|
||||
describe("Enhanced Gitea Operations", () => {
|
||||
let originalFetch: typeof global.fetch;
|
||||
let originalTimeout: typeof global.setTimeout;
|
||||
|
||||
beforeEach(() => {
|
||||
originalFetch = global.fetch;
|
||||
originalTimeout = global.setTimeout;
|
||||
// Clear mocks
|
||||
mockCreateMirrorJob.mockClear();
|
||||
mockDb.insert.mockClear();
|
||||
mockDb.update.mockClear();
|
||||
|
||||
// Mock setTimeout for consistent timing in tests
|
||||
global.setTimeout = ((fn: Function, delay: number) => {
|
||||
// Execute immediately in tests to avoid timing issues
|
||||
fn();
|
||||
return 0;
|
||||
}) as any;
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
global.fetch = originalFetch;
|
||||
global.setTimeout = originalTimeout;
|
||||
});
|
||||
|
||||
describe("getGiteaRepoInfo", () => {
|
||||
|
||||
Reference in New Issue
Block a user