File tree Expand file tree Collapse file tree
src/tools/testmanagement-utils/TCG-utils Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55 FETCH_DETAILS_URL ,
66 FORM_FIELDS_URL ,
77 BULK_CREATE_URL ,
8+ TC_DETAILS_MAX_BATCH ,
89} from "./config.js" ;
910import {
1011 DefaultFieldMaps ,
@@ -228,11 +229,13 @@ export async function pollScenariosTestDetails(
228229 if ( msg . type === "testcase" ) {
229230 const sc = msg . data . scenario ;
230231 if ( sc ) {
231- const array = Array . isArray ( msg . data . testcases )
232- ? msg . data . testcases
233- : msg . data . testcases
234- ? [ msg . data . testcases ]
235- : [ ] ;
232+ const array = (
233+ Array . isArray ( msg . data . testcases )
234+ ? msg . data . testcases
235+ : msg . data . testcases
236+ ? [ msg . data . testcases ]
237+ : [ ]
238+ ) . slice ( 0 , TC_DETAILS_MAX_BATCH ) ;
236239 const ids = array . map ( ( tc : any ) => tc . id || tc . test_case_id ) ;
237240
238241 const reqId = await fetchTestCaseDetails (
@@ -315,11 +318,12 @@ export async function bulkCreateTestCases(
315318 const BULK_CREATE_URL_VALUE = BULK_CREATE_URL ( tmBaseUrl , projectId , folderId ) ;
316319
317320 for ( const { id, testcases } of Object . values ( scenariosMap ) ) {
318- const testCaseLength = testcases . length ;
321+ const cappedTestcases = testcases . slice ( 0 , TC_DETAILS_MAX_BATCH ) ;
322+ const testCaseLength = cappedTestcases . length ;
319323 testCaseCount += testCaseLength ;
320324 if ( testCaseLength === 0 ) continue ;
321325 const payload = {
322- test_cases : testcases . map ( ( tc ) =>
326+ test_cases : cappedTestcases . map ( ( tc ) =>
323327 createTestCasePayload (
324328 tc ,
325329 id ,
Original file line number Diff line number Diff line change 1+ export const TC_DETAILS_MAX_BATCH = 10 ;
2+
13export const TCG_TRIGGER_URL = ( baseUrl : string ) =>
24 `${ baseUrl } /api/v1/integration/tcg/test-generation/suggest-test-cases` ;
35
You can’t perform that action at this time.
0 commit comments