mirror of
https://github.com/aljazceru/claude-code-viewer.git
synced 2026-01-11 01:24:22 +01:00
- Changed the setup file path in vitest configuration for better organization. - Refactored the EventBus implementation to streamline event handling. - Updated various test files to utilize new testing layers for improved clarity and maintainability. - Introduced new utility layers for file system and persistent service mocks to enhance test reliability. - Enhanced the platform layer to include necessary services for testing environments.
29 lines
743 B
TypeScript
29 lines
743 B
TypeScript
import { Effect, Layer } from "effect";
|
|
import { SessionRepository } from "../../server/core/session/infrastructure/SessionRepository";
|
|
|
|
export const testSessionRepositoryLayer = (options?: {
|
|
sessions: Array<{
|
|
id: string;
|
|
jsonlFilePath: string;
|
|
lastModifiedAt: Date;
|
|
meta: {
|
|
messageCount: number;
|
|
firstUserMessage: {
|
|
kind: "command";
|
|
commandName: string;
|
|
commandArgs?: string;
|
|
commandMessage?: string;
|
|
} | null;
|
|
};
|
|
}>;
|
|
}) => {
|
|
const { sessions = [] } = options ?? {};
|
|
|
|
return Layer.mock(SessionRepository, {
|
|
getSessions: () => {
|
|
return Effect.succeed({ sessions });
|
|
},
|
|
getSession: () => Effect.fail(new Error("Not implemented in mock")),
|
|
});
|
|
};
|