aotrautils 0.0.1594 → 0.0.1596

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
 
2
2
 
3
- /*utils COMMONS library associated with aotra version : «1_29072022-2359 (12/05/2025-16:24:40)»*/
3
+ /*utils COMMONS library associated with aotra version : «1_29072022-2359 (13/05/2025-00:24:34)»*/
4
4
  /*-----------------------------------------------------------------------------*/
5
5
 
6
6
 
@@ -433,7 +433,7 @@ if(!window.aotestAllTestsManager){
433
433
  window.aotestAllTestsManager={
434
434
  isEmpty:function(){
435
435
  let result=true;
436
- foreach(this,(test,testNameLocal)=>{
436
+ foreach(window.aotestAllTestsManager,(test,testNameLocal)=>{
437
437
  result=false;
438
438
  return "break";
439
439
  },(test,testNameLocal)=>{ return !window.aotestMethods.aotratestKeyInPredefinedParameters(testNameLocal); });
@@ -441,8 +441,9 @@ if(!window.aotestAllTestsManager){
441
441
  }
442
442
  };
443
443
 
444
- if(!window.aotestAllTestsManager.dummies)
444
+ if(!window.aotestAllTestsManager.dummies){
445
445
  window.aotestAllTestsManager.dummies=new Object();
446
+ }
446
447
  window.aotestAllTestsManager.activateAsserts=false;
447
448
  window.aotestAllTestsManager.currentRunningScenario=null;
448
449
  };
@@ -451,22 +452,19 @@ if(!window.aotestAllTestsManager){
451
452
 
452
453
  // Utility methods for aotest framework :
453
454
 
454
- window.aotestMethods.getParentTestByScenarioName=function(scenarioName){
455
- return foreach(this.getTests(),test=>{
456
- return window.aotestMethods.iterateOverScenariiInTest(test, (parentTest, scenario)=>{
455
+ window.aotestMethods.getParentTestByScenarioName=function(allTests, scenarioName){
456
+ return foreach(allTests,test=>{
457
+ return window.aotestMethods.iterateOverScenariiInSingleTest(test, (parentTest, scenario)=>{
457
458
  if(scenario.name===scenarioName)
458
459
  return parentTest;
459
460
  });
460
461
  });
461
462
  }
462
-
463
-
464
463
  window.aotestMethods.getScenarioByName=function(allTests, scenarioName){
465
464
  const result=window.aotestMethods.iterateOverScenarii(allTests, null, null, null, scenario=>scenario.name===scenarioName);
466
465
  if(result) return result;
467
466
  return null;
468
467
  }
469
-
470
468
  window.aotestMethods.getScenariiByName=function(allTests, scenariiNames){
471
469
  const results=[];
472
470
  window.aotestMethods.iterateOverScenarii(allTests, (scenario, test)=>{
@@ -474,27 +472,6 @@ window.aotestMethods.getScenariiByName=function(allTests, scenariiNames){
474
472
  }, null, null, scenario=>contains(scenariiNames,scenario.name));
475
473
  return results;
476
474
  }
477
-
478
-
479
- window.aotestMethods.getScenarioInTest=function(test, scenarioName=null){
480
- if(!scenarioName) return null;
481
- return window.aotestMethods.iterateOverScenariiInTest(test,(t,s,sName)=>{
482
- if(sName===scenarioName){
483
- return s;
484
- }
485
- });
486
- };
487
-
488
- window.aotestMethods.getScenariiInTest=function(test, scenariiNames=null){
489
- let results={};
490
- window.aotestMethods.iterateOverScenariiInTest(test,(t,s,sName)=>{
491
- if(!scenariiNames || contains(scenariiNames, sName)){
492
- results[sName]=s;
493
- }
494
- });
495
- return results;
496
- };
497
-
498
475
  window.aotestMethods.getNumberOfScenariiInGlobal=function(allTestsBagForClientReadOnly, testsType){
499
476
  let currentScenariiNumber=0;
500
477
  window.aotestMethods.iterateOverScenarii(allTestsBagForClientReadOnly, (scenario)=>{
@@ -502,43 +479,23 @@ window.aotestMethods.getNumberOfScenariiInGlobal=function(allTestsBagForClientRe
502
479
  }, testsType);
503
480
  return currentScenariiNumber;
504
481
  }
505
-
506
-
507
- window.aotestMethods.iterateOverScenariiInTest=function(test, doOnEachIteration=null){
508
- if(!doOnEachIteration) return;
509
- return foreach(test,(scenario,scenarioName)=>{
510
- const result=doOnEachIteration(test,scenario,scenarioName);
511
- if(!nothing(result)) return result;
512
- },(scenario,scenarioName)=>{ return window.aotestMethods.isScenarioName(scenarioName); });
513
- };
514
-
515
-
516
- /*public*/window.aotestMethods.iterateOverScenarii=function(allTests, doOnIteration, testsType=null, filterFunction=null, mustTerminateFunction=null){
517
-
518
- if(testsType){
519
- if(testsType==="*"){
520
- return foreach(allTests,(allTestsByType,t)=>{
521
- const loopResult=window.aotestMethods.doForAllTestsByType(allTestsByType, doOnIteration, filterFunction, mustTerminateFunction);
522
- if(loopResult)
523
- return loopResult;
524
- });
525
- }
526
-
527
- const allTestsByType=allTests[testsType];
528
- return window.aotestMethods.doForAllTestsByType(allTestsByType, doOnIteration, filterFunction, mustTerminateFunction);
482
+ window.aotestMethods.iterateOverScenarii=function(allTests, doOnIteration, testsType=null, filterFunction=null, mustTerminateFunction=null){
483
+ if(!testsType || testsType==="*"){
484
+ return foreach(allTests,(allTestsByType,t)=>{
485
+ const loopResult=window.aotestMethods.doForAllTestsByType(allTestsByType, doOnIteration, filterFunction, mustTerminateFunction);
486
+ if(loopResult)
487
+ return loopResult;
488
+ });
529
489
  }
530
-
531
- const allTestsByType=allTests;
490
+ const allTestsByType=allTests[testsType];
532
491
  return window.aotestMethods.doForAllTestsByType(allTestsByType, doOnIteration, filterFunction, mustTerminateFunction);
533
492
  };
534
493
 
535
-
536
494
  /*private*/window.aotestMethods.doForAllTestsByType=function(allTestsByType, doOnIteration, filterFunction=null, mustTerminateFunction=null){
537
-
538
495
  const loopResultI=foreach(allTestsByType,(testsByFunction,methodName)=>{
539
496
  const loopResultJ=foreach(testsByFunction,(test,executionCoupleName)=>{ // (execution couple IS test)
540
497
 
541
- const scenarii=aotestMethods.getScenariiInTest(test);
498
+ const scenarii=aotestMethods.getScenariiInSingleTest(test);
542
499
  const loopResultK=foreach(scenarii,(scenario, scenarioName)=>{
543
500
 
544
501
  if(doOnIteration) doOnIteration(scenario, test);
@@ -547,20 +504,44 @@ window.aotestMethods.iterateOverScenariiInTest=function(test, doOnEachIteration=
547
504
 
548
505
  },(scenario, scenarioName)=>!filterFunction || filterFunction(scenario));
549
506
 
550
- if(loopResultK)
551
- return loopResultK;
552
-
507
+ if(loopResultK) return loopResultK;
553
508
  });
554
509
 
555
- if(loopResultJ)
556
- return loopResultJ;
557
-
510
+ if(loopResultJ) return loopResultJ;
558
511
  });
559
512
 
560
513
  return loopResultI;
561
514
  }
562
515
 
563
516
 
517
+ window.aotestMethods.getScenarioInSingleTest=function(test, scenarioName=null){
518
+ if(!scenarioName) return null;
519
+ return window.aotestMethods.iterateOverScenariiInSingleTest(test,(t,s,sName)=>{
520
+ if(sName===scenarioName){
521
+ return s;
522
+ }
523
+ });
524
+ };
525
+ window.aotestMethods.getScenariiInSingleTest=function(test, scenariiNames=null){
526
+ let results={};
527
+ window.aotestMethods.iterateOverScenariiInSingleTest(test,(t,s,sName)=>{
528
+ if(!scenariiNames || contains(scenariiNames, sName)){
529
+ results[sName]=s;
530
+ }
531
+ });
532
+ return results;
533
+ };
534
+ window.aotestMethods.iterateOverScenariiInSingleTest=function(test, doOnEachIteration=null){
535
+ if(!doOnEachIteration) return;
536
+ return foreach(test,(scenario,scenarioName)=>{
537
+ const result=doOnEachIteration(test,scenario,scenarioName);
538
+ if(!nothing(result)) return result;
539
+ },(scenario,scenarioName)=>{ return window.aotestMethods.isScenarioName(scenarioName); });
540
+ };
541
+
542
+
543
+
544
+
564
545
 
565
546
  /*public*/window.aotestMethods.iterateOverValuesOnClonedObject=function(scenarioParam, doOnIterationForValue, visited=[], valuePath="", isValueFunction=null){
566
547
 
@@ -598,13 +579,11 @@ window.aotestMethods.iterateOverScenariiInTest=function(test, doOnEachIteration=
598
579
  scenario[itemNameOrIndex]=doOnIterationForValue(item, itemNameOrIndex, valuePath);
599
580
  }
600
581
  }
601
-
602
582
  });
603
583
 
604
584
  };
605
585
 
606
586
 
607
-
608
587
  window.aotestMethods.isScenarioName=function(scenarioName){
609
588
  return contains(scenarioName,"_scenario");
610
589
  };
@@ -1341,7 +1320,7 @@ aotest.run=function(testName=null,scenarioName=null){
1341
1320
  // // DBG
1342
1321
  // console.log("chosenTestParam",chosenTestParam);
1343
1322
 
1344
- foreach(aotestMethods.getScenariiInTest(scenariiListLocal), (scenario,scenarioNameLocal)=>{
1323
+ foreach(aotestMethods.getScenariiInSingleTest(scenariiListLocal), (scenario,scenarioNameLocal)=>{
1345
1324
 
1346
1325
  // DBG
1347
1326
  console.log("WE RUN ONE SCENARIO !!!");
@@ -4942,7 +4921,7 @@ AOTRAUTILS_LIB_IS_LOADED=true;
4942
4921
 
4943
4922
 
4944
4923
 
4945
- /*utils CLIENT library associated with aotra version : «1_29072022-2359 (12/05/2025-16:24:40)»*/
4924
+ /*utils CLIENT library associated with aotra version : «1_29072022-2359 (13/05/2025-00:24:34)»*/
4946
4925
  /*-----------------------------------------------------------------------------*/
4947
4926
  /* ## Utility global methods in a browser (htmljs) client environment.
4948
4927
  *
@@ -13544,7 +13523,7 @@ getAORTACClient=function(clientId=getUUID(), serverNodeOrigin="ws://127.0.0.1:40
13544
13523
 
13545
13524
 
13546
13525
 
13547
- /*utils GEOMETRY library associated with aotra version : «1_29072022-2359 (12/05/2025-16:24:40)»*/
13526
+ /*utils GEOMETRY library associated with aotra version : «1_29072022-2359 (13/05/2025-00:24:34)»*/
13548
13527
  /*-----------------------------------------------------------------------------*/
13549
13528
 
13550
13529
 
@@ -14783,7 +14762,7 @@ function rayVsUnitSphereClosestPoint(p, r) {
14783
14762
  // MUST REMAIN AT THE END OF THIS LIBRARY FILE !
14784
14763
 
14785
14764
  AOTRAUTILS_GEOMETRY_LIB_IS_LOADED=true;
14786
- /*utils AI library associated with aotra version : «1_29072022-2359 (12/05/2025-16:24:40)»*/
14765
+ /*utils AI library associated with aotra version : «1_29072022-2359 (13/05/2025-00:24:34)»*/
14787
14766
  /*-----------------------------------------------------------------------------*/
14788
14767
 
14789
14768
 
@@ -14929,7 +14908,7 @@ getOpenAIAPIClient=(modelName, apiURL, agentRole, defaultPrompt)=>{
14929
14908
 
14930
14909
 
14931
14910
 
14932
- /*utils CONSOLE library associated with aotra version : «1_29072022-2359 (12/05/2025-16:24:40)»*/
14911
+ /*utils CONSOLE library associated with aotra version : «1_29072022-2359 (13/05/2025-00:24:34)»*/
14933
14912
  /*-----------------------------------------------------------------------------*/
14934
14913
 
14935
14914
 
aotrautils/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aotrautils",
3
- "version": "0.0.1594",
3
+ "version": "0.0.1596",
4
4
  "main": "aotrautils.build.js",
5
5
  "description": "A library for vanilla javascript utils (client-side) used in aotra javascript CMS",
6
6
  "author": "Jeremie Ratomposon <info@alqemia.com> (https://alqemia.com)",