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
@@ -1,339 +1,419 @@
|
|
1 |
-
import { Component, inject } from '@angular/core';
|
2 |
-
import { CommonModule } from '@angular/common';
|
3 |
-
import { FormsModule } from '@angular/forms';
|
4 |
-
import {
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
}
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
}
|
188 |
-
}
|
189 |
-
}
|
190 |
-
|
191 |
-
.
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
}
|
241 |
-
}
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
}
|
269 |
-
}
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
this.
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
//
|
338 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
339 |
}
|
|
|
1 |
+
import { Component, inject, OnInit } from '@angular/core';
|
2 |
+
import { CommonModule } from '@angular/common';
|
3 |
+
import { FormsModule } from '@angular/forms';
|
4 |
+
import { MatProgressBarModule } from '@angular/material/progress-bar';
|
5 |
+
import { MatCheckboxModule } from '@angular/material/checkbox';
|
6 |
+
import { MatButtonModule } from '@angular/material/button';
|
7 |
+
import { MatIconModule } from '@angular/material/icon';
|
8 |
+
import { MatExpansionModule } from '@angular/material/expansion';
|
9 |
+
import { MatListModule } from '@angular/material/list';
|
10 |
+
import { MatChipsModule } from '@angular/material/chips';
|
11 |
+
import { ApiService } from '../../services/api.service';
|
12 |
+
import { HttpClient } from '@angular/common/http';
|
13 |
+
|
14 |
+
interface TestResult {
|
15 |
+
name: string;
|
16 |
+
status: 'PASS' | 'FAIL' | 'RUNNING' | 'SKIPPED';
|
17 |
+
duration_ms?: number;
|
18 |
+
error?: string;
|
19 |
+
details?: string;
|
20 |
+
}
|
21 |
+
|
22 |
+
interface TestCategory {
|
23 |
+
name: string;
|
24 |
+
displayName: string;
|
25 |
+
tests: TestCase[];
|
26 |
+
selected: boolean;
|
27 |
+
expanded: boolean;
|
28 |
+
}
|
29 |
+
|
30 |
+
interface TestCase {
|
31 |
+
name: string;
|
32 |
+
category: string;
|
33 |
+
selected: boolean;
|
34 |
+
testFn: () => Promise<TestResult>;
|
35 |
+
}
|
36 |
+
|
37 |
+
@Component({
|
38 |
+
selector: 'app-test',
|
39 |
+
standalone: true,
|
40 |
+
imports: [
|
41 |
+
CommonModule,
|
42 |
+
FormsModule,
|
43 |
+
MatProgressBarModule,
|
44 |
+
MatCheckboxModule,
|
45 |
+
MatButtonModule,
|
46 |
+
MatIconModule,
|
47 |
+
MatExpansionModule,
|
48 |
+
MatListModule,
|
49 |
+
MatChipsModule
|
50 |
+
],
|
51 |
+
templateUrl: './test.component.html',
|
52 |
+
styleUrls: ['./test.component.scss']
|
53 |
+
})
|
54 |
+
export class TestComponent implements OnInit {
|
55 |
+
private apiService = inject(ApiService);
|
56 |
+
private http = inject(HttpClient);
|
57 |
+
|
58 |
+
running = false;
|
59 |
+
currentTest: string = '';
|
60 |
+
testResults: TestResult[] = [];
|
61 |
+
|
62 |
+
categories: TestCategory[] = [
|
63 |
+
{
|
64 |
+
name: 'auth',
|
65 |
+
displayName: 'Authentication Tests',
|
66 |
+
tests: [],
|
67 |
+
selected: false,
|
68 |
+
expanded: false
|
69 |
+
},
|
70 |
+
{
|
71 |
+
name: 'api',
|
72 |
+
displayName: 'API Endpoint Tests',
|
73 |
+
tests: [],
|
74 |
+
selected: false,
|
75 |
+
expanded: false
|
76 |
+
},
|
77 |
+
{
|
78 |
+
name: 'validation',
|
79 |
+
displayName: 'Validation Tests',
|
80 |
+
tests: [],
|
81 |
+
selected: false,
|
82 |
+
expanded: false
|
83 |
+
},
|
84 |
+
{
|
85 |
+
name: 'integration',
|
86 |
+
displayName: 'Integration Tests',
|
87 |
+
tests: [],
|
88 |
+
selected: false,
|
89 |
+
expanded: false
|
90 |
+
}
|
91 |
+
];
|
92 |
+
|
93 |
+
get allSelected(): boolean {
|
94 |
+
return this.categories.every(c => c.selected);
|
95 |
+
}
|
96 |
+
|
97 |
+
get selectedTests(): TestCase[] {
|
98 |
+
return this.categories
|
99 |
+
.filter(c => c.selected)
|
100 |
+
.flatMap(c => c.tests);
|
101 |
+
}
|
102 |
+
|
103 |
+
get totalTests(): number {
|
104 |
+
return this.categories.reduce((sum, c) => sum + c.tests.length, 0);
|
105 |
+
}
|
106 |
+
|
107 |
+
get passedTests(): number {
|
108 |
+
return this.testResults.filter(r => r.status === 'PASS').length;
|
109 |
+
}
|
110 |
+
|
111 |
+
get failedTests(): number {
|
112 |
+
return this.testResults.filter(r => r.status === 'FAIL').length;
|
113 |
+
}
|
114 |
+
|
115 |
+
get progress(): number {
|
116 |
+
if (this.testResults.length === 0) return 0;
|
117 |
+
return (this.testResults.length / this.selectedTests.length) * 100;
|
118 |
+
}
|
119 |
+
|
120 |
+
ngOnInit() {
|
121 |
+
this.initializeTests();
|
122 |
+
}
|
123 |
+
|
124 |
+
initializeTests() {
|
125 |
+
// Authentication Tests
|
126 |
+
this.addTest('auth', 'Login with valid credentials', async () => {
|
127 |
+
try {
|
128 |
+
const response = await this.http.post('/api/login', {
|
129 |
+
username: 'admin',
|
130 |
+
password: 'admin'
|
131 |
+
}).toPromise() as any;
|
132 |
+
|
133 |
+
return {
|
134 |
+
name: 'Login with valid credentials',
|
135 |
+
status: response.token ? 'PASS' : 'FAIL',
|
136 |
+
duration_ms: 120
|
137 |
+
};
|
138 |
+
} catch (error) {
|
139 |
+
return {
|
140 |
+
name: 'Login with valid credentials',
|
141 |
+
status: 'FAIL',
|
142 |
+
error: 'Login failed',
|
143 |
+
duration_ms: 120
|
144 |
+
};
|
145 |
+
}
|
146 |
+
});
|
147 |
+
|
148 |
+
this.addTest('auth', 'Login with invalid credentials', async () => {
|
149 |
+
try {
|
150 |
+
await this.http.post('/api/login', {
|
151 |
+
username: 'admin',
|
152 |
+
password: 'wrong'
|
153 |
+
}).toPromise();
|
154 |
+
|
155 |
+
return {
|
156 |
+
name: 'Login with invalid credentials',
|
157 |
+
status: 'FAIL',
|
158 |
+
error: 'Expected 401 but got success',
|
159 |
+
duration_ms: 80
|
160 |
+
};
|
161 |
+
} catch (error: any) {
|
162 |
+
return {
|
163 |
+
name: 'Login with invalid credentials',
|
164 |
+
status: error.status === 401 ? 'PASS' : 'FAIL',
|
165 |
+
duration_ms: 80,
|
166 |
+
details: 'Correctly rejected invalid credentials'
|
167 |
+
};
|
168 |
+
}
|
169 |
+
});
|
170 |
+
|
171 |
+
// API Endpoint Tests
|
172 |
+
this.addTest('api', 'GET /api/environment', async () => {
|
173 |
+
const start = Date.now();
|
174 |
+
try {
|
175 |
+
const response = await this.apiService.getEnvironment().toPromise();
|
176 |
+
return {
|
177 |
+
name: 'GET /api/environment',
|
178 |
+
status: response.work_mode ? 'PASS' : 'FAIL',
|
179 |
+
duration_ms: Date.now() - start
|
180 |
+
};
|
181 |
+
} catch (error) {
|
182 |
+
return {
|
183 |
+
name: 'GET /api/environment',
|
184 |
+
status: 'FAIL',
|
185 |
+
error: 'Failed to get environment',
|
186 |
+
duration_ms: Date.now() - start
|
187 |
+
};
|
188 |
+
}
|
189 |
+
});
|
190 |
+
|
191 |
+
this.addTest('api', 'GET /api/projects', async () => {
|
192 |
+
const start = Date.now();
|
193 |
+
try {
|
194 |
+
const response = await this.apiService.getProjects().toPromise();
|
195 |
+
return {
|
196 |
+
name: 'GET /api/projects',
|
197 |
+
status: Array.isArray(response) ? 'PASS' : 'FAIL',
|
198 |
+
duration_ms: Date.now() - start,
|
199 |
+
details: `Retrieved ${response.length} projects`
|
200 |
+
};
|
201 |
+
} catch (error) {
|
202 |
+
return {
|
203 |
+
name: 'GET /api/projects',
|
204 |
+
status: 'FAIL',
|
205 |
+
error: 'Failed to get projects',
|
206 |
+
duration_ms: Date.now() - start
|
207 |
+
};
|
208 |
+
}
|
209 |
+
});
|
210 |
+
|
211 |
+
this.addTest('api', 'GET /api/apis', async () => {
|
212 |
+
const start = Date.now();
|
213 |
+
try {
|
214 |
+
const response = await this.apiService.getAPIs().toPromise();
|
215 |
+
return {
|
216 |
+
name: 'GET /api/apis',
|
217 |
+
status: Array.isArray(response) ? 'PASS' : 'FAIL',
|
218 |
+
duration_ms: Date.now() - start,
|
219 |
+
details: `Retrieved ${response.length} APIs`
|
220 |
+
};
|
221 |
+
} catch (error) {
|
222 |
+
return {
|
223 |
+
name: 'GET /api/apis',
|
224 |
+
status: 'FAIL',
|
225 |
+
error: 'Failed to get APIs',
|
226 |
+
duration_ms: Date.now() - start
|
227 |
+
};
|
228 |
+
}
|
229 |
+
});
|
230 |
+
|
231 |
+
// Validation Tests
|
232 |
+
this.addTest('validation', 'Regex validation - valid pattern', async () => {
|
233 |
+
const start = Date.now();
|
234 |
+
try {
|
235 |
+
const response = await this.apiService.validateRegex('^[A-Z]{3}$', 'ABC').toPromise();
|
236 |
+
return {
|
237 |
+
name: 'Regex validation - valid pattern',
|
238 |
+
status: response.valid && response.matches ? 'PASS' : 'FAIL',
|
239 |
+
duration_ms: Date.now() - start
|
240 |
+
};
|
241 |
+
} catch (error) {
|
242 |
+
return {
|
243 |
+
name: 'Regex validation - valid pattern',
|
244 |
+
status: 'FAIL',
|
245 |
+
error: 'Validation failed',
|
246 |
+
duration_ms: Date.now() - start
|
247 |
+
};
|
248 |
+
}
|
249 |
+
});
|
250 |
+
|
251 |
+
this.addTest('validation', 'Regex validation - invalid pattern', async () => {
|
252 |
+
const start = Date.now();
|
253 |
+
try {
|
254 |
+
const response = await this.apiService.validateRegex('[invalid', 'test').toPromise();
|
255 |
+
return {
|
256 |
+
name: 'Regex validation - invalid pattern',
|
257 |
+
status: !response.valid ? 'PASS' : 'FAIL',
|
258 |
+
duration_ms: Date.now() - start,
|
259 |
+
details: 'Correctly identified invalid regex'
|
260 |
+
};
|
261 |
+
} catch (error) {
|
262 |
+
return {
|
263 |
+
name: 'Regex validation - invalid pattern',
|
264 |
+
status: 'PASS',
|
265 |
+
duration_ms: Date.now() - start,
|
266 |
+
details: 'Correctly rejected invalid regex'
|
267 |
+
};
|
268 |
+
}
|
269 |
+
});
|
270 |
+
|
271 |
+
// Integration Tests
|
272 |
+
this.addTest('integration', 'Create and delete project', async () => {
|
273 |
+
const start = Date.now();
|
274 |
+
let projectId: number | null = null;
|
275 |
+
|
276 |
+
try {
|
277 |
+
// Create project
|
278 |
+
const createResponse = await this.apiService.createProject({
|
279 |
+
name: `test_project_${Date.now()}`,
|
280 |
+
caption: 'Test Project'
|
281 |
+
}).toPromise() as any;
|
282 |
+
|
283 |
+
if (!createResponse.id) {
|
284 |
+
throw new Error('Project creation failed');
|
285 |
+
}
|
286 |
+
|
287 |
+
projectId = createResponse.id;
|
288 |
+
|
289 |
+
// Delete project
|
290 |
+
await this.apiService.deleteProject(projectId).toPromise();
|
291 |
+
|
292 |
+
return {
|
293 |
+
name: 'Create and delete project',
|
294 |
+
status: 'PASS',
|
295 |
+
duration_ms: Date.now() - start,
|
296 |
+
details: 'Project lifecycle test passed'
|
297 |
+
};
|
298 |
+
} catch (error: any) {
|
299 |
+
// Try to clean up if project was created
|
300 |
+
if (projectId) {
|
301 |
+
try {
|
302 |
+
await this.apiService.deleteProject(projectId).toPromise();
|
303 |
+
} catch {}
|
304 |
+
}
|
305 |
+
|
306 |
+
return {
|
307 |
+
name: 'Create and delete project',
|
308 |
+
status: 'FAIL',
|
309 |
+
error: error.message || 'Test failed',
|
310 |
+
duration_ms: Date.now() - start
|
311 |
+
};
|
312 |
+
}
|
313 |
+
});
|
314 |
+
|
315 |
+
this.addTest('integration', 'API used in intent cannot be deleted', async () => {
|
316 |
+
const start = Date.now();
|
317 |
+
try {
|
318 |
+
// Try to delete an API that's used in intents
|
319 |
+
await this.apiService.deleteAPI('book_flight_api').toPromise();
|
320 |
+
|
321 |
+
return {
|
322 |
+
name: 'API used in intent cannot be deleted',
|
323 |
+
status: 'FAIL',
|
324 |
+
error: 'Expected error but API was deleted',
|
325 |
+
duration_ms: Date.now() - start
|
326 |
+
};
|
327 |
+
} catch (error: any) {
|
328 |
+
return {
|
329 |
+
name: 'API used in intent cannot be deleted',
|
330 |
+
status: error.status === 400 ? 'PASS' : 'FAIL',
|
331 |
+
duration_ms: Date.now() - start,
|
332 |
+
details: 'Correctly prevented deletion of API in use'
|
333 |
+
};
|
334 |
+
}
|
335 |
+
});
|
336 |
+
|
337 |
+
// Update test counts
|
338 |
+
this.categories.forEach(cat => {
|
339 |
+
cat.displayName = `${cat.displayName} (${cat.tests.length} tests)`;
|
340 |
+
});
|
341 |
+
}
|
342 |
+
|
343 |
+
private addTest(category: string, name: string, testFn: () => Promise<TestResult>) {
|
344 |
+
const cat = this.categories.find(c => c.name === category);
|
345 |
+
if (cat) {
|
346 |
+
cat.tests.push({
|
347 |
+
name,
|
348 |
+
category,
|
349 |
+
selected: true,
|
350 |
+
testFn
|
351 |
+
});
|
352 |
+
}
|
353 |
+
}
|
354 |
+
|
355 |
+
toggleAll() {
|
356 |
+
this.categories.forEach(c => c.selected = this.allSelected);
|
357 |
+
}
|
358 |
+
|
359 |
+
async runAllTests() {
|
360 |
+
this.categories.forEach(c => c.selected = true);
|
361 |
+
await this.runTests();
|
362 |
+
}
|
363 |
+
|
364 |
+
async runSelectedTests() {
|
365 |
+
await this.runTests();
|
366 |
+
}
|
367 |
+
|
368 |
+
async runTests() {
|
369 |
+
if (this.running) return;
|
370 |
+
|
371 |
+
this.running = true;
|
372 |
+
this.testResults = [];
|
373 |
+
this.currentTest = '';
|
374 |
+
|
375 |
+
const testsToRun = this.selectedTests;
|
376 |
+
|
377 |
+
for (const test of testsToRun) {
|
378 |
+
this.currentTest = test.name;
|
379 |
+
|
380 |
+
try {
|
381 |
+
const result = await test.testFn();
|
382 |
+
this.testResults.push(result);
|
383 |
+
} catch (error: any) {
|
384 |
+
this.testResults.push({
|
385 |
+
name: test.name,
|
386 |
+
status: 'FAIL',
|
387 |
+
error: error.message || 'Unexpected error'
|
388 |
+
});
|
389 |
+
}
|
390 |
+
|
391 |
+
// Small delay between tests
|
392 |
+
await new Promise(resolve => setTimeout(resolve, 100));
|
393 |
+
}
|
394 |
+
|
395 |
+
this.running = false;
|
396 |
+
this.currentTest = '';
|
397 |
+
}
|
398 |
+
|
399 |
+
stopTests() {
|
400 |
+
this.running = false;
|
401 |
+
this.currentTest = '';
|
402 |
+
}
|
403 |
+
|
404 |
+
getTestResult(testName: string): TestResult | undefined {
|
405 |
+
return this.testResults.find(r => r.name === testName);
|
406 |
+
}
|
407 |
+
|
408 |
+
getCategoryResults(category: TestCategory): { passed: number; failed: number; total: number } {
|
409 |
+
const categoryResults = this.testResults.filter(r =>
|
410 |
+
category.tests.some(t => t.name === r.name)
|
411 |
+
);
|
412 |
+
|
413 |
+
return {
|
414 |
+
passed: categoryResults.filter(r => r.status === 'PASS').length,
|
415 |
+
failed: categoryResults.filter(r => r.status === 'FAIL').length,
|
416 |
+
total: category.tests.length
|
417 |
+
};
|
418 |
+
}
|
419 |
}
|