fix(test): update seed scripts to require valid plan handle IDs
- Replace placeholder plan IDs with explicit warnings - Change from test_project_X to PLACEHOLDER_ID_X - Add validation to prevent seeding with placeholders - Add helpful error messages with usage examples - Add comprehensive guide for getting valid plan IDs - Methods: Create projects, query database, check account settings - Format examples: UUID, hash, custom formats - Step-by-step instructions for each method - Troubleshooting common issues - Update test-user-zero.ts with placeholder warnings - Clear instructions on how to get real plan IDs - Links to documentation - Notes about plan ID format variations - Improve test server startup - Warn when using placeholder IDs - Allow plan IDs via command line argument - Provide guidance on updating config The previous test_project_X IDs were not valid for real TimeSafari databases. Users must now provide actual plan handle IDs from their TimeSafari setup, making testing more realistic and avoiding silent failures with invalid IDs.
This commit is contained in:
@@ -70,13 +70,27 @@ function generateTestProjectWithClaim(handleId, index = 0) {
|
||||
|
||||
/**
|
||||
* Default test project IDs from config
|
||||
*
|
||||
* NOTE: These are placeholder IDs. For real testing, replace with valid plan handle IDs
|
||||
* from your TimeSafari database. Valid plan IDs can be obtained by:
|
||||
*
|
||||
* 1. Creating a project in the TimeSafari app and noting its handleId
|
||||
* 2. Querying your local database for existing plan handleIds
|
||||
* 3. Using the plan handleIds from your starred projects in account settings
|
||||
*
|
||||
* Plan handle IDs typically follow the format used by your TimeSafari backend.
|
||||
* If your localhost has no projects, you may need to create test projects first
|
||||
* or use the IDs from your staging/production environment.
|
||||
*/
|
||||
const DEFAULT_TEST_PROJECT_IDS = [
|
||||
"test_project_1",
|
||||
"test_project_2",
|
||||
"test_project_3",
|
||||
"demo_project_alpha",
|
||||
"demo_project_beta"
|
||||
// Replace these with actual plan handle IDs from your TimeSafari setup
|
||||
// Example formats (check your actual database for real IDs):
|
||||
// - UUID format: "550e8400-e29b-41d4-a716-446655440000"
|
||||
// - Hash format: "abc123def456"
|
||||
// - Or whatever format your TimeSafari API uses
|
||||
"PLACEHOLDER_ID_1",
|
||||
"PLACEHOLDER_ID_2",
|
||||
"PLACEHOLDER_ID_3"
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -205,6 +219,16 @@ if (require.main === module) {
|
||||
{
|
||||
const filename = args[1] || 'test-projects.json';
|
||||
const projectIds = args[2] ? args[2].split(',') : DEFAULT_TEST_PROJECT_IDS;
|
||||
|
||||
if (projectIds.some(id => id.startsWith('PLACEHOLDER'))) {
|
||||
console.warn('⚠️ WARNING: Using placeholder IDs. Replace with real plan handle IDs from your TimeSafari database.');
|
||||
console.warn(' To get valid IDs:');
|
||||
console.warn(' 1. Create projects in TimeSafari app');
|
||||
console.warn(' 2. Query your database for plan handleIds');
|
||||
console.warn(' 3. Use IDs from starred projects in account settings');
|
||||
console.warn('');
|
||||
}
|
||||
|
||||
exportToJSON(filename, projectIds);
|
||||
}
|
||||
break;
|
||||
@@ -213,6 +237,14 @@ if (require.main === module) {
|
||||
{
|
||||
const apiUrl = args[1] || 'http://localhost:3000';
|
||||
const projectIds = args[2] ? args[2].split(',') : DEFAULT_TEST_PROJECT_IDS;
|
||||
|
||||
if (projectIds.some(id => id.startsWith('PLACEHOLDER'))) {
|
||||
console.error('❌ ERROR: Cannot seed with placeholder IDs. Please provide valid plan handle IDs.');
|
||||
console.error(' Usage: node scripts/seed-test-projects.js seed <apiUrl> "<id1>,<id2>,<id3>"');
|
||||
console.error(' Example: node scripts/seed-test-projects.js seed http://localhost:3000 "550e8400-e29b-41d4-a716-446655440000,abc123def456"');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
seedToLocalhost(apiUrl, projectIds)
|
||||
.then(() => {
|
||||
console.log('✅ Seeding complete');
|
||||
@@ -229,6 +261,11 @@ if (require.main === module) {
|
||||
default:
|
||||
{
|
||||
const projectIds = args[1] ? args[1].split(',') : DEFAULT_TEST_PROJECT_IDS;
|
||||
|
||||
if (projectIds.some(id => id.startsWith('PLACEHOLDER'))) {
|
||||
console.warn('⚠️ WARNING: Using placeholder IDs. These need to be replaced with real plan handle IDs.');
|
||||
}
|
||||
|
||||
const projects = generateAllTestProjects(projectIds);
|
||||
console.log(JSON.stringify({ data: projects }, null, 2));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user