Many fixes

This commit is contained in:
2026-09-14 08:00:08 +00:00
parent 93b012592b
commit 2d970d3123
15 changed files with 338 additions and 176 deletions
+29
View File
@@ -0,0 +1,29 @@
import { vi } from "vitest";
import type { AuthSecp256k1 } from "../../source/auth/auth";
import type { RouteDefinition, RouteModule } from "../../source/routes/types";
/**
* Convert an array of route definitions to a route module by returning an object with a getRoutes method that returns the routes.
* @param routes - The route definitions to convert.
* @returns A route module.
*/
export const toRoutes = (routes: RouteDefinition[]): RouteModule => {
return {
getRoutes: async () => routes,
};
};
export const mockAuth = {
verifySignature: vi.fn().mockResolvedValue(true),
verifyUniqueRequest: vi.fn().mockResolvedValue(true),
assertTimestampFreshness: vi.fn().mockResolvedValue(true),
} as unknown as AuthSecp256k1;
/**
* Create a mock of the AuthSecp256k1 service
* @returns A mock of the AuthSecp256k1 service
*/
export const createMockAuth = (): AuthSecp256k1 => {
return mockAuth;
};