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:
37
tests/support/fixtures/factories/user-factory.ts
Normal file
37
tests/support/fixtures/factories/user-factory.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
import { faker } from '@faker-js/faker';
|
||||
|
||||
/**
|
||||
* UserFactory
|
||||
*
|
||||
* Handles creation and cleanup of test users.
|
||||
* Note: Since this is a local-first app without a real backend API for user creation yet,
|
||||
* this factory currently generates mock data. adapting to real API calls later.
|
||||
*/
|
||||
export class UserFactory {
|
||||
// In a real app, we would track IDs here for cleanup
|
||||
// private createdUserIds: string[] = [];
|
||||
|
||||
async createUser(overrides = {}) {
|
||||
const user = {
|
||||
id: faker.string.uuid(),
|
||||
email: faker.internet.email(),
|
||||
name: faker.person.fullName(),
|
||||
password: faker.internet.password(),
|
||||
createdAt: new Date().toISOString(),
|
||||
...overrides,
|
||||
};
|
||||
|
||||
// Placeholder: In a real app, you would POST to API here
|
||||
// const response = await fetch(\`\${process.env.API_URL}/users\`, ...);
|
||||
|
||||
return user;
|
||||
}
|
||||
|
||||
async cleanup() {
|
||||
// Placeholder: In a real app, you would DELETE users here
|
||||
// for (const id of this.createdUserIds) { ... }
|
||||
|
||||
// For now, no cleanup needed for transient mock data
|
||||
return Promise.resolve();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user