mirror of
https://github.com/aljazceru/claude-code-viewer.git
synced 2026-01-13 18:44:25 +01:00
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.
This commit is contained in:
28
src/testing/layers/testSessionRepositoryLayer.ts
Normal file
28
src/testing/layers/testSessionRepositoryLayer.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
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")),
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user