Spaces:
Building
Building
Update flare-ui/src/app/components/test/test.component.ts
Browse files
flare-ui/src/app/components/test/test.component.ts
CHANGED
@@ -228,27 +228,24 @@ export class TestComponent implements OnInit {
|
|
228 |
}
|
229 |
});
|
230 |
|
231 |
-
// Integration Tests
|
232 |
// Integration Tests
|
233 |
this.addTest('integration', 'Create and delete project', async () => {
|
234 |
const start = Date.now();
|
235 |
-
let
|
236 |
|
237 |
try {
|
238 |
// Create project
|
239 |
-
|
240 |
name: `test_project_${Date.now()}`,
|
241 |
caption: 'Test Project'
|
242 |
-
}).toPromise()
|
243 |
|
244 |
-
if (!
|
245 |
-
throw new Error('Project creation failed');
|
246 |
}
|
247 |
|
248 |
-
|
249 |
-
|
250 |
-
// Delete project
|
251 |
-
await this.apiService.deleteProject(projectId).toPromise();
|
252 |
|
253 |
return {
|
254 |
name: 'Create and delete project',
|
@@ -258,10 +255,12 @@ export class TestComponent implements OnInit {
|
|
258 |
};
|
259 |
} catch (error: any) {
|
260 |
// Try to clean up if project was created
|
261 |
-
if (
|
262 |
try {
|
263 |
-
await this.apiService.deleteProject(
|
264 |
-
} catch {
|
|
|
|
|
265 |
}
|
266 |
|
267 |
return {
|
|
|
228 |
}
|
229 |
});
|
230 |
|
|
|
231 |
// Integration Tests
|
232 |
this.addTest('integration', 'Create and delete project', async () => {
|
233 |
const start = Date.now();
|
234 |
+
let createdProject: any = null;
|
235 |
|
236 |
try {
|
237 |
// Create project
|
238 |
+
createdProject = await this.apiService.createProject({
|
239 |
name: `test_project_${Date.now()}`,
|
240 |
caption: 'Test Project'
|
241 |
+
}).toPromise();
|
242 |
|
243 |
+
if (!createdProject?.id) {
|
244 |
+
throw new Error('Project creation failed - no ID returned');
|
245 |
}
|
246 |
|
247 |
+
// Delete project - ID is guaranteed to exist here
|
248 |
+
await this.apiService.deleteProject(createdProject.id).toPromise();
|
|
|
|
|
249 |
|
250 |
return {
|
251 |
name: 'Create and delete project',
|
|
|
255 |
};
|
256 |
} catch (error: any) {
|
257 |
// Try to clean up if project was created
|
258 |
+
if (createdProject?.id) {
|
259 |
try {
|
260 |
+
await this.apiService.deleteProject(createdProject.id).toPromise();
|
261 |
+
} catch (cleanupError) {
|
262 |
+
console.error('Cleanup failed:', cleanupError);
|
263 |
+
}
|
264 |
}
|
265 |
|
266 |
return {
|