mirror of
https://github.com/RayLabsHQ/gitea-mirror.git
synced 2025-12-06 19:46:44 +03:00
test fix
This commit is contained in:
@@ -38,17 +38,27 @@ import { repoStatusEnum } from "@/types/Repository";
|
|||||||
|
|
||||||
describe("Enhanced Gitea Operations", () => {
|
describe("Enhanced Gitea Operations", () => {
|
||||||
let originalFetch: typeof global.fetch;
|
let originalFetch: typeof global.fetch;
|
||||||
|
let originalTimeout: typeof global.setTimeout;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
originalFetch = global.fetch;
|
originalFetch = global.fetch;
|
||||||
|
originalTimeout = global.setTimeout;
|
||||||
// Clear mocks
|
// Clear mocks
|
||||||
mockCreateMirrorJob.mockClear();
|
mockCreateMirrorJob.mockClear();
|
||||||
mockDb.insert.mockClear();
|
mockDb.insert.mockClear();
|
||||||
mockDb.update.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(() => {
|
afterEach(() => {
|
||||||
global.fetch = originalFetch;
|
global.fetch = originalFetch;
|
||||||
|
global.setTimeout = originalTimeout;
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("getGiteaRepoInfo", () => {
|
describe("getGiteaRepoInfo", () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user