fix(test): use valid URI format for plan handle IDs
- Update plan handle ID format to match TimeSafari specification - Default format: https://endorser.ch/entity/{26-char-ULID} - ULID: 26 characters, Crockford base32 encoded - Validates RFC 3986 URI format - Add ULID generation functions - generateULID() creates 26-character Crockford base32 strings - generateValidPlanHandleId() creates full URI format IDs - Auto-generates valid IDs for testing - Update DEFAULT_TEST_PROJECT_IDS - Now generates valid URI format IDs automatically - Removes placeholder warnings (IDs are now valid format) - Add URI validation to seed scripts - Validates plan IDs match RFC 3986 URI format - Error messages with format examples - Blocks seeding with invalid formats - Update test-user-zero.ts config - Auto-generates valid URI format plan IDs - Clear documentation of required format - Note that real IDs from database should replace test IDs - Update documentation - Document default URI format specification - Explain ULID structure and encoding - Show examples of valid formats This ensures all test project IDs match the actual TimeSafari plan handle ID format, preventing validation errors during prefetch testing.
This commit is contained in:
@@ -81,27 +81,37 @@ export const TEST_USER_ZERO_CONFIG = {
|
||||
|
||||
// Test Starred Projects (mock data for testing)
|
||||
starredProjects: {
|
||||
// IMPORTANT: Replace these with valid plan handle IDs from your TimeSafari database
|
||||
// IMPORTANT: Plan handle IDs must be valid URIs (RFC 3986 format)
|
||||
//
|
||||
// Default format: https://endorser.ch/entity/{26-char-ULID}
|
||||
// - ULID is 26 characters, Crockford base32 (e.g., 01GQBE7Q0RQQAGJMEEW6RSGKTF)
|
||||
// - Any valid URI scheme is accepted: http://, https://, did:, etc.
|
||||
//
|
||||
// To get valid plan IDs:
|
||||
// 1. Create projects in TimeSafari app and note their handleId from API responses
|
||||
// 1. Create projects in TimeSafari app and note handleId from API responses
|
||||
// 2. Query your local database: SELECT handleId FROM plans LIMIT 5
|
||||
// 3. Check starred projects in account settings: settings.starredPlanHandleIds
|
||||
// 3. Check starred projects: settings.starredPlanHandleIds
|
||||
// 4. See docs/getting-valid-plan-ids.md for detailed instructions
|
||||
//
|
||||
// Plan handle IDs can be:
|
||||
// - UUIDs: "550e8400-e29b-41d4-a716-446655440000"
|
||||
// - Hashes: "abc123def456789"
|
||||
// - Or any format your TimeSafari backend uses
|
||||
//
|
||||
// For localhost testing with no projects, you can:
|
||||
// - Use the test API server: node scripts/test-api-server-with-seed.js
|
||||
// - Or create test projects first, then use their IDs here
|
||||
planIds: [
|
||||
"PLACEHOLDER_ID_1", // Replace with real plan handle ID
|
||||
"PLACEHOLDER_ID_2", // Replace with real plan handle ID
|
||||
"PLACEHOLDER_ID_3" // Replace with real plan handle ID
|
||||
],
|
||||
// These are auto-generated valid URIs for testing structure.
|
||||
// Replace with real IDs from your TimeSafari database for actual testing.
|
||||
planIds: ((): string[] => {
|
||||
// Generate valid URI format IDs for testing
|
||||
const generateULID = (): string => {
|
||||
const alphabet = '0123456789ABCDEFGHJKMNPQRSTVWXYZ';
|
||||
const timestamp = Date.now().toString(36).toUpperCase().padStart(10, '0');
|
||||
const random = Array.from({ length: 16 }, () =>
|
||||
alphabet[Math.floor(Math.random() * alphabet.length)]
|
||||
).join('');
|
||||
return (timestamp + random).substring(0, 26);
|
||||
};
|
||||
|
||||
return [
|
||||
`https://endorser.ch/entity/${generateULID()}`,
|
||||
`https://endorser.ch/entity/${generateULID()}`,
|
||||
`https://endorser.ch/entity/${generateULID()}`
|
||||
];
|
||||
})(),
|
||||
|
||||
// Last acknowledged JWT ID (for pagination testing)
|
||||
lastAckedJwtId: "1704067200_abc123_def45678"
|
||||
|
||||
Reference in New Issue
Block a user