Initial commit: Brachnha Insight project setup
- Next.js 14+ with App Router and TypeScript - Tailwind CSS and ShadCN UI styling - Zustand state management - Dexie.js for IndexedDB (local-first data) - Auth.js v5 for authentication - BMAD framework integration Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
48
tests/support/factories/history-entry.factory.ts
Normal file
48
tests/support/factories/history-entry.factory.ts
Normal file
@@ -0,0 +1,48 @@
|
||||
import { faker } from '@faker-js/faker';
|
||||
|
||||
export interface ChatSession {
|
||||
id: string;
|
||||
title: string;
|
||||
date: string; // ISO string
|
||||
preview: string;
|
||||
tags: string[];
|
||||
status: 'active' | 'completed';
|
||||
messages: Array<{
|
||||
id: string;
|
||||
role: 'user' | 'assistant';
|
||||
content: string;
|
||||
timestamp: number;
|
||||
}>;
|
||||
}
|
||||
|
||||
export const createChatSession = (overrides: Partial<ChatSession> = {}): ChatSession => {
|
||||
const timestamp = faker.date.recent().getTime();
|
||||
|
||||
return {
|
||||
id: faker.string.uuid(),
|
||||
title: faker.lorem.sentence(3),
|
||||
date: new Date(timestamp).toISOString(),
|
||||
preview: faker.lorem.sentence(),
|
||||
tags: [faker.word.sample(), faker.word.sample()],
|
||||
status: 'completed',
|
||||
messages: [
|
||||
{
|
||||
id: faker.string.uuid(),
|
||||
role: 'user',
|
||||
content: faker.lorem.paragraph(),
|
||||
timestamp: timestamp - 10000,
|
||||
},
|
||||
{
|
||||
id: faker.string.uuid(),
|
||||
role: 'assistant',
|
||||
content: faker.lorem.paragraph(),
|
||||
timestamp: timestamp,
|
||||
}
|
||||
],
|
||||
...overrides,
|
||||
};
|
||||
};
|
||||
|
||||
export const createChatSessions = (count: number, overrides: Partial<ChatSession> = {}): ChatSession[] => {
|
||||
return Array.from({ length: count }, () => createChatSession(overrides));
|
||||
};
|
||||
Reference in New Issue
Block a user