Closed elsaperelli closed 1 year ago
St.:grey_question: |
Category | Percentage | Covered / Total |
---|---|---|---|
π’ | Statements | 84.89% (-0.84% π») |
1960/2309 |
π‘ | Branches | 73.46% (-0.36% π») |
1722/2344 |
π’ | Functions | 87.44% (-1.28% π») |
348/398 |
π’ | Lines | 85.17% (-0.81% π») |
1889/2218 |
353 tests passing in 28 suites.
Report generated by π§ͺjest coverage report action from f889a9429c316e5ad20a941db279a68dd11800b4
Summary
Before, we had only the option to calculate dataRequirements on a measure bundle. Now, we can calculate dataRequirements on a collection of Library resources (library bundle). This will be helpful when we implement Library/$data-requirements in the measure-repository-service.
New behavior
New function in
Calculator.ts
calculates library dataRequirements from a Library bundle. This is in addition to the calculateDataRequirements function that calculates the dataRequirements on a measure bundle.Code changes
src/calculation/Calculator.ts
- new functioncalculateLibrarydataRequirements
gets data requirements for a collection of Library resources. A lot of this code was identical to that incalculateDataRequirements
but we wanted them to be separate functions so I refactored the duplicate code into a function inDataRequirementHelpers.ts
.src/cli.ts
- new cli option to runlibraryDataRequirements
with a flag with therootLibRef
.src/helpers/DataRequirementHelpers.ts
- refactored a lot of the identical code incalculateDataRequirements
andcalculateLibraryDataRequirements
to thegetDataRequirements
function.src/helpers/MeasureBundleHelpers.ts
-extractLibrariesFromLibraryBundle
gets libraries from a library bundle andextractLibrariesFromMeasureBundle
gets libraries from a measure bundle. They both useextractLibrariesFromBundle
because a lot of the code was the same. The main difference is thatextractLibrariesFromLibraryBundle
has to take a reference to the root library as a parameter, since there is no measure on the bundle to indicate the root library like inextractLibrariesFromMeasureBundle
.src/helpers/elm/ELMInfoCache.ts
- changedextractLibrariesFromBundle
toextractLibrariesFromMeasureBundle
.src/types/Calculator.ts
- addedrootLibRef
as an optional CalculationOption which we need inlibraryDataRequirements
in the cli.test/unit/helpers/ELMInfoCache.test.ts
- changedextractLibrariesFromBundle
toextractLibrariesFromMeasureBundle
.test/unit/helpers/MeasureBundleHelpers.test.ts
- added a test forextractLibrariesFromLibraryBundle
. This uses theELM130-7.3.000-bundles-nocodes.json
fixture that we already have but filters is so that it is a bundle of only its library resources.Testing guidance
npm run check
EXM130-7.3.000-bundle-nocodes.json
fixture because it is there. I suggest you do the same since I attached that file and the one with only the library resources below, but feel free to try other bundles!npm run cli -- dataRequirements -m <path-to-EXM130-7.3.000-bundle-nocodes.json> -o
output.json
filenpm run cli -- libraryDataRequirements -m <path-to-EXM130.7.3.000-library-nocodes.json --root-lib-ref "Library-library-EXM130-7.3.000 -o
output.json
file.LibraryDataRequirementsTestFiles.zip