Many fixes
This commit is contained in:
@@ -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;
|
||||
};
|
||||
Reference in New Issue
Block a user