test: update tests

This commit is contained in:
2026-02-05 04:12:12 +05:00
parent 0c3c97914e
commit c71e8b8b4a
8 changed files with 156 additions and 49 deletions
+12 -13
View File
@@ -1,20 +1,19 @@
// Use global test functions with globals enabled in config
import { AppError } from "$lib/types/errors";
import { createError, handleError, isRecoverableError, logError, retryOperation } from "$lib/utils/errorHandler";
let consoleErrorSpy: any;
beforeEach(() => {
consoleErrorSpy = vi.spyOn(console, "error").mockImplementation(() => {});
});
afterEach(() => {
consoleErrorSpy.mockClear();
vi.restoreAllMocks();
});
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
describe("errorHandler", () => {
let consoleErrorSpy: any;
beforeEach(() => {
consoleErrorSpy = vi.spyOn(console, "error").mockImplementation(() => {});
});
afterEach(() => {
consoleErrorSpy.mockClear();
vi.restoreAllMocks();
});
describe("handleError", () => {
it("should handle AppError with recoverable flag", () => {
const error = new AppError("Test error", "TEST_ERROR", true);