()
| 78 | } |
| 79 | |
| 80 | async function testProjects() { |
| 81 | console.log('\n📁 Testing Projects endpoints...\n'); |
| 82 | |
| 83 | // Create project |
| 84 | const createResult = await makeRequest('POST', '/manage/projects', { |
| 85 | name: `Test Project ${Date.now()}`, |
| 86 | domain: 'https://example.com', |
| 87 | cors: ['https://example.com', 'https://www.example.com'], |
| 88 | crossDomain: false, |
| 89 | types: ['website'], |
| 90 | }); |
| 91 | results.push(createResult); |
| 92 | console.log( |
| 93 | `✓ POST /manage/projects: ${createResult.success ? '✅' : '❌'} ${createResult.status}`, |
| 94 | ); |
| 95 | if (createResult.error) console.log(` Error: ${createResult.error}`); |
| 96 | |
| 97 | const projectId = createResult.data?.data?.id; |
| 98 | const clientId = createResult.data?.data?.client?.id; |
| 99 | const clientSecret = createResult.data?.data?.client?.secret; |
| 100 | |
| 101 | if (projectId) { |
| 102 | console.log(` Created project: ${projectId}`); |
| 103 | if (clientId) console.log(` Created client: ${clientId}`); |
| 104 | if (clientSecret) console.log(` Client secret: ${clientSecret}`); |
| 105 | } |
| 106 | |
| 107 | // List projects |
| 108 | const listResult = await makeRequest('GET', '/manage/projects'); |
| 109 | results.push(listResult); |
| 110 | console.log( |
| 111 | `✓ GET /manage/projects: ${listResult.success ? '✅' : '❌'} ${listResult.status}`, |
| 112 | ); |
| 113 | if (listResult.data?.data?.length) { |
| 114 | console.log(` Found ${listResult.data.data.length} projects`); |
| 115 | } |
| 116 | |
| 117 | if (projectId) { |
| 118 | // Get project |
| 119 | const getResult = await makeRequest('GET', `/manage/projects/${projectId}`); |
| 120 | results.push(getResult); |
| 121 | console.log( |
| 122 | `✓ GET /manage/projects/:id: ${getResult.success ? '✅' : '❌'} ${getResult.status}`, |
| 123 | ); |
| 124 | |
| 125 | // Update project |
| 126 | const updateResult = await makeRequest( |
| 127 | 'PATCH', |
| 128 | `/manage/projects/${projectId}`, |
| 129 | { |
| 130 | name: 'Updated Test Project', |
| 131 | crossDomain: true, |
| 132 | }, |
| 133 | ); |
| 134 | results.push(updateResult); |
| 135 | console.log( |
| 136 | `✓ PATCH /manage/projects/:id: ${updateResult.success ? '✅' : '❌'} ${updateResult.status}`, |
| 137 | ); |
no test coverage detected