feat: test case filtering (#276)

This commit is contained in:
Eliezer Castro
2025-08-24 12:15:39 -03:00
committed by GitHub
parent 720ec7c508
commit afe569a79c
11 changed files with 432 additions and 69 deletions

View File

@@ -26,8 +26,20 @@ async function fetchCase(jwt: string, caseId: number) {
}
}
async function fetchCases(jwt: string, folderId: number) {
const url = `${apiServer}/cases?folderId=${folderId}`;
async function fetchCases(jwt: string, folderId: number, priority?: number[], type?: number[]) {
const queryParams = [`folderId=${folderId}`];
if (priority && priority.length > 0) {
queryParams.push(`priority=${priority.join(',')}`);
}
if (type && type.length > 0) {
queryParams.push(`type=${type.join(',')}`);
}
const query = queryParams.length > 0 ? `?${queryParams.join('&')}` : '';
const url = `${apiServer}/cases${query}`;
try {
const response = await fetch(url, {
@@ -43,9 +55,10 @@ async function fetchCases(jwt: string, folderId: number) {
}
const data = await response.json();
return data;
return data || [];
} catch (error: unknown) {
logError('Error fetching data', error);
return [];
}
}