Files
claude-code-viewer/src/testing/layers/testSessionRepositoryLayer.ts
d-kimsuon a77d7e205b refactor: update testing layers and configurations
- 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.
2025-10-18 20:07:47 +09:00

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")),
});
};