@featurevisor/core 2.26.1 → 3.0.1
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.
- package/CHANGELOG.md +8 -0
- package/coverage/clover.xml +4991 -3130
- package/coverage/coverage-final.json +63 -39
- package/coverage/lcov-report/block-navigation.js +1 -1
- package/coverage/lcov-report/index.html +248 -98
- package/coverage/lcov-report/sorter.js +21 -7
- package/coverage/lcov-report/src/assess-distribution/index.html +116 -0
- package/coverage/lcov-report/src/assess-distribution/index.ts.html +754 -0
- package/coverage/lcov-report/{list → src/benchmark}/index.html +30 -30
- package/coverage/lcov-report/src/benchmark/index.ts.html +793 -0
- package/coverage/lcov-report/{builder → src/builder}/allocator.ts.html +38 -38
- package/coverage/lcov-report/{builder/buildScopedConditions.ts.html → src/builder/applyContextToConditions.ts.html} +80 -65
- package/coverage/lcov-report/{builder/buildScopedDatafile.ts.html → src/builder/applyContextToDatafile.ts.html} +92 -92
- package/coverage/lcov-report/{builder/buildScopedSegments.ts.html → src/builder/applyContextToSegments.ts.html} +103 -67
- package/coverage/lcov-report/{builder → src/builder}/buildDatafile.ts.html +336 -306
- package/coverage/lcov-report/src/builder/buildProject.ts.html +1117 -0
- package/coverage/lcov-report/src/builder/buildRuntimeDatafiles.ts.html +256 -0
- package/coverage/lcov-report/{builder → src/builder}/getFeatureRanges.ts.html +22 -22
- package/coverage/lcov-report/{builder → src/builder}/hashes.ts.html +50 -50
- package/coverage/lcov-report/{builder → src/builder}/index.html +114 -84
- package/coverage/lcov-report/{tester/cliFormat.ts.html → src/builder/index.ts.html} +17 -29
- package/coverage/lcov-report/{builder → src/builder}/mutateVariables.ts.html +55 -55
- package/coverage/lcov-report/{builder → src/builder}/mutator.ts.html +118 -118
- package/coverage/lcov-report/{builder → src/builder}/revision.ts.html +15 -15
- package/coverage/lcov-report/{builder → src/builder}/traffic.ts.html +86 -86
- package/coverage/lcov-report/src/cli/cli.ts.html +400 -0
- package/coverage/lcov-report/{tester → src/cli}/index.html +41 -41
- package/coverage/lcov-report/src/cli/plugins.ts.html +214 -0
- package/coverage/lcov-report/{config → src/config}/index.html +31 -31
- package/coverage/lcov-report/{config → src/config}/index.ts.html +12 -12
- package/coverage/lcov-report/{config → src/config}/projectConfig.ts.html +312 -96
- package/coverage/lcov-report/{datasource → src/datasource}/adapter.ts.html +28 -73
- package/coverage/lcov-report/{datasource → src/datasource}/datasource.ts.html +191 -104
- package/coverage/lcov-report/{datasource → src/datasource}/filesystemAdapter.ts.html +233 -635
- package/coverage/lcov-report/{datasource → src/datasource}/index.html +48 -48
- package/coverage/lcov-report/{datasource → src/datasource}/index.ts.html +14 -14
- package/coverage/lcov-report/src/evaluate/index.html +116 -0
- package/coverage/lcov-report/src/evaluate/index.ts.html +814 -0
- package/coverage/lcov-report/src/find-duplicate-segments/findDuplicateSegments.ts.html +313 -0
- package/coverage/lcov-report/src/find-duplicate-segments/index.html +131 -0
- package/coverage/lcov-report/src/find-duplicate-segments/index.ts.html +307 -0
- package/coverage/lcov-report/src/find-usage/index.html +116 -0
- package/coverage/lcov-report/src/find-usage/index.ts.html +1780 -0
- package/coverage/lcov-report/src/generate-code/index.html +131 -0
- package/coverage/lcov-report/src/generate-code/index.ts.html +403 -0
- package/coverage/lcov-report/{generate-code → src/generate-code}/typescript.ts.html +266 -1361
- package/coverage/lcov-report/{generate-code → src}/index.html +38 -23
- package/coverage/lcov-report/src/info/index.html +116 -0
- package/coverage/lcov-report/src/info/index.ts.html +472 -0
- package/coverage/lcov-report/src/init/index.html +116 -0
- package/coverage/lcov-report/src/init/index.ts.html +280 -0
- package/coverage/lcov-report/{linter → src/linter}/attributeSchema.ts.html +160 -157
- package/coverage/lcov-report/{linter → src/linter}/checkCircularDependency.ts.html +25 -25
- package/coverage/lcov-report/{linter → src/linter}/checkPercentageExceedingSlot.ts.html +42 -42
- package/coverage/lcov-report/{linter → src/linter}/conditionSchema.ts.html +207 -207
- package/coverage/lcov-report/{linter → src/linter}/featureSchema.ts.html +462 -471
- package/coverage/lcov-report/{linter → src/linter}/groupSchema.ts.html +25 -22
- package/coverage/lcov-report/{linter → src/linter}/index.html +129 -99
- package/coverage/lcov-report/src/linter/index.ts.html +88 -0
- package/coverage/lcov-report/{linter → src/linter}/lintProject.ts.html +740 -332
- package/coverage/lcov-report/{linter → src/linter}/mutationNotation.ts.html +130 -130
- package/coverage/lcov-report/{linter → src/linter}/printError.ts.html +27 -27
- package/coverage/lcov-report/{linter → src/linter}/schema.ts.html +153 -150
- package/coverage/lcov-report/{linter → src/linter}/segmentSchema.ts.html +18 -15
- package/coverage/lcov-report/src/linter/targetSchema.ts.html +223 -0
- package/coverage/lcov-report/{linter → src/linter}/testSchema.ts.html +54 -48
- package/coverage/lcov-report/{linter → src/linter}/zodHelpers.ts.html +17 -17
- package/coverage/lcov-report/src/list/index.html +131 -0
- package/coverage/lcov-report/src/list/index.ts.html +2065 -0
- package/coverage/lcov-report/{list → src/list}/matrix.ts.html +43 -58
- package/coverage/lcov-report/src/promoter/index.html +116 -0
- package/coverage/lcov-report/src/promoter/index.ts.html +3883 -0
- package/coverage/lcov-report/src/sets.ts.html +313 -0
- package/coverage/lcov-report/src/targeting.ts.html +403 -0
- package/coverage/lcov-report/src/tester/cliFormat.ts.html +133 -0
- package/coverage/lcov-report/{tester → src/tester}/helpers.ts.html +15 -15
- package/coverage/lcov-report/src/tester/index.html +206 -0
- package/coverage/lcov-report/src/tester/prettyDuration.ts.html +187 -0
- package/coverage/lcov-report/src/tester/printTestResult.ts.html +337 -0
- package/coverage/lcov-report/src/tester/testFeature.ts.html +1186 -0
- package/coverage/lcov-report/src/tester/testProject.ts.html +1018 -0
- package/coverage/lcov-report/src/tester/testSegment.ts.html +316 -0
- package/coverage/lcov-report/{utils → src/utils}/extractKeys.ts.html +68 -68
- package/coverage/lcov-report/{utils → src/utils}/git.ts.html +44 -68
- package/coverage/lcov-report/{utils → src/utils}/index.html +44 -44
- package/coverage/lcov-report/{utils → src/utils}/index.ts.html +14 -14
- package/coverage/lcov-report/{utils → src/utils}/pretty.ts.html +20 -20
- package/coverage/lcov.info +10121 -5723
- package/jest.config.js +13 -4
- package/lib/assess-distribution/index.d.ts +1 -1
- package/lib/assess-distribution/index.js +59 -40
- package/lib/assess-distribution/index.js.map +1 -1
- package/lib/benchmark/index.d.ts +8 -5
- package/lib/benchmark/index.js +82 -65
- package/lib/benchmark/index.js.map +1 -1
- package/lib/builder/applyContextToConditions.d.ts +5 -0
- package/lib/builder/{buildScopedConditions.js → applyContextToConditions.js} +19 -14
- package/lib/builder/applyContextToConditions.js.map +1 -0
- package/lib/builder/applyContextToDatafile.d.ts +2 -0
- package/lib/builder/{buildScopedDatafile.js → applyContextToDatafile.js} +26 -26
- package/lib/builder/applyContextToDatafile.js.map +1 -0
- package/lib/builder/applyContextToSegments.d.ts +5 -0
- package/lib/builder/{buildScopedSegments.js → applyContextToSegments.js} +19 -14
- package/lib/builder/applyContextToSegments.js.map +1 -0
- package/lib/builder/buildDatafile.d.ts +9 -6
- package/lib/builder/buildDatafile.js +86 -51
- package/lib/builder/buildDatafile.js.map +1 -1
- package/lib/builder/buildProject.d.ts +17 -3
- package/lib/builder/buildProject.js +151 -59
- package/lib/builder/buildProject.js.map +1 -1
- package/lib/builder/buildRuntimeDatafiles.d.ts +12 -0
- package/lib/builder/buildRuntimeDatafiles.js +35 -0
- package/lib/builder/buildRuntimeDatafiles.js.map +1 -0
- package/lib/builder/getFeatureRanges.js +34 -1
- package/lib/builder/getFeatureRanges.js.map +1 -1
- package/lib/builder/hashes.js +34 -1
- package/lib/builder/hashes.js.map +1 -1
- package/lib/builder/index.d.ts +0 -1
- package/lib/builder/index.js +0 -1
- package/lib/builder/index.js.map +1 -1
- package/lib/cli/cli.js +0 -4
- package/lib/cli/cli.js.map +1 -1
- package/lib/cli/plugins.js +7 -2
- package/lib/cli/plugins.js.map +1 -1
- package/lib/config/projectConfig.d.ts +17 -17
- package/lib/config/projectConfig.js +101 -15
- package/lib/config/projectConfig.js.map +1 -1
- package/lib/datasource/adapter.d.ts +7 -9
- package/lib/datasource/adapter.js +0 -7
- package/lib/datasource/adapter.js.map +1 -1
- package/lib/datasource/datasource.d.ts +15 -5
- package/lib/datasource/datasource.js +37 -9
- package/lib/datasource/datasource.js.map +1 -1
- package/lib/datasource/filesystemAdapter.d.ts +4 -10
- package/lib/datasource/filesystemAdapter.js +111 -149
- package/lib/datasource/filesystemAdapter.js.map +1 -1
- package/lib/evaluate/index.d.ts +1 -7
- package/lib/evaluate/index.js +81 -67
- package/lib/evaluate/index.js.map +1 -1
- package/lib/find-duplicate-segments/findDuplicateSegments.js +34 -1
- package/lib/find-duplicate-segments/findDuplicateSegments.js.map +1 -1
- package/lib/find-duplicate-segments/index.js +21 -13
- package/lib/find-duplicate-segments/index.js.map +1 -1
- package/lib/find-usage/index.js +57 -41
- package/lib/find-usage/index.js.map +1 -1
- package/lib/generate-code/index.d.ts +1 -1
- package/lib/generate-code/index.js +64 -21
- package/lib/generate-code/index.js.map +1 -1
- package/lib/generate-code/typescript.d.ts +1 -1
- package/lib/generate-code/typescript.js +59 -333
- package/lib/generate-code/typescript.js.map +1 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib/info/index.js +57 -16
- package/lib/info/index.js.map +1 -1
- package/lib/init/index.d.ts +2 -2
- package/lib/init/index.js +39 -3
- package/lib/init/index.js.map +1 -1
- package/lib/linter/attributeSchema.d.ts +1 -0
- package/lib/linter/attributeSchema.js +1 -0
- package/lib/linter/attributeSchema.js.map +1 -1
- package/lib/linter/conditionSchema.js +5 -5
- package/lib/linter/conditionSchema.js.map +1 -1
- package/lib/linter/featureSchema.d.ts +4 -1
- package/lib/linter/featureSchema.js +15 -13
- package/lib/linter/featureSchema.js.map +1 -1
- package/lib/linter/groupSchema.d.ts +1 -0
- package/lib/linter/groupSchema.js +1 -0
- package/lib/linter/groupSchema.js.map +1 -1
- package/lib/linter/lintProject.d.ts +1 -3
- package/lib/linter/lintProject.js +198 -68
- package/lib/linter/lintProject.js.map +1 -1
- package/lib/linter/schema.js +1 -0
- package/lib/linter/schema.js.map +1 -1
- package/lib/linter/segmentSchema.d.ts +1 -0
- package/lib/linter/segmentSchema.js +1 -0
- package/lib/linter/segmentSchema.js.map +1 -1
- package/lib/linter/targetSchema.d.ts +16 -0
- package/lib/linter/targetSchema.js +40 -0
- package/lib/linter/targetSchema.js.map +1 -0
- package/lib/linter/testSchema.d.ts +4 -3
- package/lib/linter/testSchema.js +9 -4
- package/lib/linter/testSchema.js.map +1 -1
- package/lib/list/index.d.ts +1 -0
- package/lib/list/index.js +131 -12
- package/lib/list/index.js.map +1 -1
- package/lib/list/matrix.js +3 -7
- package/lib/list/matrix.js.map +1 -1
- package/lib/promoter/index.d.ts +50 -0
- package/lib/promoter/index.js +880 -0
- package/lib/promoter/index.js.map +1 -0
- package/lib/sets.d.ts +11 -0
- package/lib/sets.js +81 -0
- package/lib/sets.js.map +1 -0
- package/lib/targeting.d.ts +14 -0
- package/lib/targeting.js +82 -0
- package/lib/targeting.js.map +1 -0
- package/lib/tester/cliFormat.d.ts +7 -1
- package/lib/tester/cliFormat.js +11 -2
- package/lib/tester/cliFormat.js.map +1 -1
- package/lib/tester/printTestResult.js +2 -2
- package/lib/tester/printTestResult.js.map +1 -1
- package/lib/tester/testFeature.d.ts +0 -1
- package/lib/tester/testFeature.js +8 -25
- package/lib/tester/testFeature.js.map +1 -1
- package/lib/tester/testProject.d.ts +2 -3
- package/lib/tester/testProject.js +93 -86
- package/lib/tester/testProject.js.map +1 -1
- package/lib/tester/testSegment.d.ts +1 -1
- package/lib/tester/testSegment.js +3 -21
- package/lib/tester/testSegment.js.map +1 -1
- package/lib/utils/git.js +45 -19
- package/lib/utils/git.js.map +1 -1
- package/package.json +12 -12
- package/src/assess-distribution/index.ts +72 -52
- package/src/benchmark/index.ts +124 -91
- package/src/builder/{buildScopedConditions.spec.ts → applyContextToConditions.spec.ts} +160 -142
- package/src/builder/{buildScopedConditions.ts → applyContextToConditions.ts} +19 -14
- package/src/builder/{buildScopedDatafile.spec.ts → applyContextToDatafile.spec.ts} +141 -81
- package/src/builder/{buildScopedDatafile.ts → applyContextToDatafile.ts} +33 -33
- package/src/builder/{buildScopedSegments.spec.ts → applyContextToSegments.spec.ts} +171 -151
- package/src/builder/{buildScopedSegments.ts → applyContextToSegments.ts} +26 -14
- package/src/builder/buildDatafile.spec.ts +192 -14
- package/src/builder/buildDatafile.ts +74 -64
- package/src/builder/buildProject.ts +171 -86
- package/src/builder/buildRuntimeDatafiles.ts +57 -0
- package/src/builder/index.ts +0 -1
- package/src/cli/cli.ts +0 -5
- package/src/cli/plugins.ts +7 -2
- package/src/config/projectConfig.spec.ts +171 -8
- package/src/config/projectConfig.ts +100 -28
- package/src/datasource/adapter.ts +8 -23
- package/src/datasource/datasource.ts +50 -21
- package/src/datasource/filesystemAdapter.spec.ts +133 -74
- package/src/datasource/filesystemAdapter.ts +93 -227
- package/src/evaluate/index.ts +109 -97
- package/src/find-duplicate-segments/index.ts +34 -16
- package/src/find-usage/index.ts +89 -44
- package/src/generate-code/index.ts +36 -24
- package/src/generate-code/typescript.spec.ts +106 -0
- package/src/generate-code/typescript.ts +33 -398
- package/src/index.ts +2 -1
- package/src/info/index.ts +72 -16
- package/src/init/index.ts +1 -1
- package/src/linter/attributeSchema.ts +1 -0
- package/src/linter/conditionSchema.spec.ts +23 -3
- package/src/linter/conditionSchema.ts +5 -5
- package/src/linter/featureSchema.spec.ts +107 -18
- package/src/linter/featureSchema.ts +25 -28
- package/src/linter/groupSchema.ts +1 -0
- package/src/linter/lintProject.spec.ts +131 -92
- package/src/linter/lintProject.ts +233 -97
- package/src/linter/schema.ts +1 -0
- package/src/linter/segmentSchema.spec.ts +5 -3
- package/src/linter/segmentSchema.ts +1 -0
- package/src/linter/targetSchema.spec.ts +159 -0
- package/src/linter/targetSchema.ts +46 -0
- package/src/linter/testSchema.spec.ts +70 -5
- package/src/linter/testSchema.ts +12 -10
- package/src/list/index.spec.ts +135 -0
- package/src/list/index.ts +188 -12
- package/src/list/matrix.ts +3 -8
- package/src/promoter/index.spec.ts +617 -0
- package/src/promoter/index.ts +1266 -0
- package/src/sets.ts +76 -0
- package/src/targeting.spec.ts +74 -0
- package/src/targeting.ts +106 -0
- package/src/tester/cliFormat.ts +11 -1
- package/src/tester/printTestResult.ts +12 -3
- package/src/tester/testFeature.ts +10 -36
- package/src/tester/testProject.spec.ts +50 -0
- package/src/tester/testProject.ts +89 -140
- package/src/tester/testSegment.ts +5 -22
- package/src/utils/git.ts +13 -21
- package/tsconfig.cjs.json +5 -1
- package/tsconfig.typecheck.json +9 -0
- package/coverage/lcov-report/builder/convertToV1.ts.html +0 -583
- package/lib/builder/allocator.spec.d.ts +0 -1
- package/lib/builder/allocator.spec.js +0 -85
- package/lib/builder/allocator.spec.js.map +0 -1
- package/lib/builder/buildDatafile.spec.d.ts +0 -1
- package/lib/builder/buildDatafile.spec.js +0 -233
- package/lib/builder/buildDatafile.spec.js.map +0 -1
- package/lib/builder/buildScopedConditions.d.ts +0 -5
- package/lib/builder/buildScopedConditions.js.map +0 -1
- package/lib/builder/buildScopedConditions.spec.d.ts +0 -1
- package/lib/builder/buildScopedConditions.spec.js +0 -2167
- package/lib/builder/buildScopedConditions.spec.js.map +0 -1
- package/lib/builder/buildScopedDatafile.d.ts +0 -2
- package/lib/builder/buildScopedDatafile.js.map +0 -1
- package/lib/builder/buildScopedDatafile.spec.d.ts +0 -1
- package/lib/builder/buildScopedDatafile.spec.js +0 -2277
- package/lib/builder/buildScopedDatafile.spec.js.map +0 -1
- package/lib/builder/buildScopedSegments.d.ts +0 -5
- package/lib/builder/buildScopedSegments.js.map +0 -1
- package/lib/builder/buildScopedSegments.spec.d.ts +0 -1
- package/lib/builder/buildScopedSegments.spec.js +0 -1062
- package/lib/builder/buildScopedSegments.spec.js.map +0 -1
- package/lib/builder/convertToV1.d.ts +0 -10
- package/lib/builder/convertToV1.js +0 -119
- package/lib/builder/convertToV1.js.map +0 -1
- package/lib/builder/mutateVariables.spec.d.ts +0 -1
- package/lib/builder/mutateVariables.spec.js +0 -1074
- package/lib/builder/mutateVariables.spec.js.map +0 -1
- package/lib/builder/mutator.spec.d.ts +0 -1
- package/lib/builder/mutator.spec.js +0 -368
- package/lib/builder/mutator.spec.js.map +0 -1
- package/lib/builder/revision.spec.d.ts +0 -1
- package/lib/builder/revision.spec.js +0 -21
- package/lib/builder/revision.spec.js.map +0 -1
- package/lib/builder/traffic.spec.d.ts +0 -1
- package/lib/builder/traffic.spec.js +0 -872
- package/lib/builder/traffic.spec.js.map +0 -1
- package/lib/config/projectConfig.spec.d.ts +0 -1
- package/lib/config/projectConfig.spec.js +0 -24
- package/lib/config/projectConfig.spec.js.map +0 -1
- package/lib/datasource/filesystemAdapter.spec.d.ts +0 -1
- package/lib/datasource/filesystemAdapter.spec.js +0 -88
- package/lib/datasource/filesystemAdapter.spec.js.map +0 -1
- package/lib/generate-code/typescript.spec.d.ts +0 -1
- package/lib/generate-code/typescript.spec.js +0 -78
- package/lib/generate-code/typescript.spec.js.map +0 -1
- package/lib/linter/attributeSchema.spec.d.ts +0 -1
- package/lib/linter/attributeSchema.spec.js +0 -266
- package/lib/linter/attributeSchema.spec.js.map +0 -1
- package/lib/linter/conditionSchema.spec.d.ts +0 -1
- package/lib/linter/conditionSchema.spec.js +0 -380
- package/lib/linter/conditionSchema.spec.js.map +0 -1
- package/lib/linter/featureSchema.spec.d.ts +0 -1
- package/lib/linter/featureSchema.spec.js +0 -1552
- package/lib/linter/featureSchema.spec.js.map +0 -1
- package/lib/linter/lintProject.spec.d.ts +0 -1
- package/lib/linter/lintProject.spec.js +0 -211
- package/lib/linter/lintProject.spec.js.map +0 -1
- package/lib/linter/mutationNotation.spec.d.ts +0 -1
- package/lib/linter/mutationNotation.spec.js +0 -598
- package/lib/linter/mutationNotation.spec.js.map +0 -1
- package/lib/linter/schema.spec.d.ts +0 -1
- package/lib/linter/schema.spec.js +0 -535
- package/lib/linter/schema.spec.js.map +0 -1
- package/lib/linter/segmentSchema.spec.d.ts +0 -1
- package/lib/linter/segmentSchema.spec.js +0 -303
- package/lib/linter/segmentSchema.spec.js.map +0 -1
- package/lib/linter/testSchema.spec.d.ts +0 -1
- package/lib/linter/testSchema.spec.js +0 -162
- package/lib/linter/testSchema.spec.js.map +0 -1
- package/lib/list/matrix.spec.d.ts +0 -1
- package/lib/list/matrix.spec.js +0 -42
- package/lib/list/matrix.spec.js.map +0 -1
- package/lib/site/exportSite.d.ts +0 -2
- package/lib/site/exportSite.js +0 -30
- package/lib/site/exportSite.js.map +0 -1
- package/lib/site/generateHistory.d.ts +0 -3
- package/lib/site/generateHistory.js +0 -31
- package/lib/site/generateHistory.js.map +0 -1
- package/lib/site/generateSiteSearchIndex.d.ts +0 -4
- package/lib/site/generateSiteSearchIndex.js +0 -195
- package/lib/site/generateSiteSearchIndex.js.map +0 -1
- package/lib/site/getLastModifiedFromHistory.d.ts +0 -2
- package/lib/site/getLastModifiedFromHistory.js +0 -18
- package/lib/site/getLastModifiedFromHistory.js.map +0 -1
- package/lib/site/getOwnerAndRepoFromUrl.d.ts +0 -4
- package/lib/site/getOwnerAndRepoFromUrl.js +0 -20
- package/lib/site/getOwnerAndRepoFromUrl.js.map +0 -1
- package/lib/site/getRelativePaths.d.ts +0 -6
- package/lib/site/getRelativePaths.js +0 -15
- package/lib/site/getRelativePaths.js.map +0 -1
- package/lib/site/getRepoDetails.d.ts +0 -8
- package/lib/site/getRepoDetails.js +0 -48
- package/lib/site/getRepoDetails.js.map +0 -1
- package/lib/site/index.d.ts +0 -2
- package/lib/site/index.js +0 -43
- package/lib/site/index.js.map +0 -1
- package/lib/site/serveSite.d.ts +0 -2
- package/lib/site/serveSite.js +0 -54
- package/lib/site/serveSite.js.map +0 -1
- package/lib/tester/helpers.spec.d.ts +0 -1
- package/lib/tester/helpers.spec.js +0 -115
- package/lib/tester/helpers.spec.js.map +0 -1
- package/src/builder/convertToV1.ts +0 -166
- package/src/site/exportSite.ts +0 -42
- package/src/site/generateHistory.ts +0 -40
- package/src/site/generateSiteSearchIndex.ts +0 -258
- package/src/site/getLastModifiedFromHistory.ts +0 -21
- package/src/site/getOwnerAndRepoFromUrl.ts +0 -17
- package/src/site/getRelativePaths.ts +0 -24
- package/src/site/getRepoDetails.ts +0 -62
- package/src/site/index.ts +0 -46
- package/src/site/serveSite.ts +0 -58
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { Condition, DatafileContent } from "@featurevisor/types";
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
|
-
|
|
4
|
+
applyContextToCondition,
|
|
5
5
|
removeRedundantConditions,
|
|
6
|
-
|
|
7
|
-
} from "./
|
|
8
|
-
import {
|
|
6
|
+
applyContextToConditions,
|
|
7
|
+
} from "./applyContextToConditions";
|
|
8
|
+
import { createFeaturevisor } from "@featurevisor/sdk";
|
|
9
9
|
|
|
10
|
-
describe("core:
|
|
10
|
+
describe("core: applyContextToConditions", function () {
|
|
11
11
|
const emptyDatafile: DatafileContent = {
|
|
12
12
|
schemaVersion: "2",
|
|
13
13
|
revision: "unknown",
|
|
@@ -15,24 +15,24 @@ describe("core: buildScopedConditions", function () {
|
|
|
15
15
|
features: {},
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
const
|
|
18
|
+
const featurevisor = createFeaturevisor({
|
|
19
19
|
datafile: emptyDatafile,
|
|
20
|
-
|
|
20
|
+
logLevel: "fatal",
|
|
21
21
|
});
|
|
22
22
|
|
|
23
|
-
describe("
|
|
24
|
-
test("
|
|
25
|
-
expect(
|
|
23
|
+
describe("applyContextToConditions (plural)", function () {
|
|
24
|
+
test("applyContextToConditions is a function", function () {
|
|
25
|
+
expect(applyContextToConditions).toBeInstanceOf(Function);
|
|
26
26
|
});
|
|
27
27
|
|
|
28
28
|
test("simple cases", function () {
|
|
29
29
|
// "*" remains "*"
|
|
30
|
-
expect(
|
|
30
|
+
expect(applyContextToConditions(featurevisor, "*", {})).toEqual("*");
|
|
31
31
|
|
|
32
32
|
// Plain condition that matches
|
|
33
33
|
expect(
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
applyContextToConditions(
|
|
35
|
+
featurevisor,
|
|
36
36
|
{
|
|
37
37
|
attribute: "platform",
|
|
38
38
|
operator: "equals",
|
|
@@ -46,8 +46,8 @@ describe("core: buildScopedConditions", function () {
|
|
|
46
46
|
|
|
47
47
|
// Plain condition that doesn't match
|
|
48
48
|
expect(
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
applyContextToConditions(
|
|
50
|
+
featurevisor,
|
|
51
51
|
{
|
|
52
52
|
attribute: "platform",
|
|
53
53
|
operator: "equals",
|
|
@@ -65,8 +65,8 @@ describe("core: buildScopedConditions", function () {
|
|
|
65
65
|
|
|
66
66
|
// Array of conditions - partial match (redundant "*" removed)
|
|
67
67
|
expect(
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
applyContextToConditions(
|
|
69
|
+
featurevisor,
|
|
70
70
|
[
|
|
71
71
|
{
|
|
72
72
|
attribute: "platform",
|
|
@@ -93,8 +93,8 @@ describe("core: buildScopedConditions", function () {
|
|
|
93
93
|
|
|
94
94
|
// Array of conditions - full match (all "*" becomes "*")
|
|
95
95
|
expect(
|
|
96
|
-
|
|
97
|
-
|
|
96
|
+
applyContextToConditions(
|
|
97
|
+
featurevisor,
|
|
98
98
|
[
|
|
99
99
|
{
|
|
100
100
|
attribute: "platform",
|
|
@@ -116,8 +116,8 @@ describe("core: buildScopedConditions", function () {
|
|
|
116
116
|
|
|
117
117
|
// Array of conditions - no match
|
|
118
118
|
expect(
|
|
119
|
-
|
|
120
|
-
|
|
119
|
+
applyContextToConditions(
|
|
120
|
+
featurevisor,
|
|
121
121
|
[
|
|
122
122
|
{
|
|
123
123
|
attribute: "platform",
|
|
@@ -152,8 +152,8 @@ describe("core: buildScopedConditions", function () {
|
|
|
152
152
|
test("AND conditions", function () {
|
|
153
153
|
// AND with all matching conditions (all "*" becomes "*")
|
|
154
154
|
expect(
|
|
155
|
-
|
|
156
|
-
|
|
155
|
+
applyContextToConditions(
|
|
156
|
+
featurevisor,
|
|
157
157
|
{
|
|
158
158
|
and: [
|
|
159
159
|
{
|
|
@@ -177,8 +177,8 @@ describe("core: buildScopedConditions", function () {
|
|
|
177
177
|
|
|
178
178
|
// AND with partial match (redundant "*" removed)
|
|
179
179
|
expect(
|
|
180
|
-
|
|
181
|
-
|
|
180
|
+
applyContextToConditions(
|
|
181
|
+
featurevisor,
|
|
182
182
|
{
|
|
183
183
|
and: [
|
|
184
184
|
{
|
|
@@ -209,8 +209,8 @@ describe("core: buildScopedConditions", function () {
|
|
|
209
209
|
|
|
210
210
|
// AND with no matches
|
|
211
211
|
expect(
|
|
212
|
-
|
|
213
|
-
|
|
212
|
+
applyContextToConditions(
|
|
213
|
+
featurevisor,
|
|
214
214
|
{
|
|
215
215
|
and: [
|
|
216
216
|
{
|
|
@@ -247,8 +247,8 @@ describe("core: buildScopedConditions", function () {
|
|
|
247
247
|
|
|
248
248
|
// AND with "*" in it (all "*" becomes "*")
|
|
249
249
|
expect(
|
|
250
|
-
|
|
251
|
-
|
|
250
|
+
applyContextToConditions(
|
|
251
|
+
featurevisor,
|
|
252
252
|
{
|
|
253
253
|
and: [
|
|
254
254
|
"*",
|
|
@@ -271,8 +271,8 @@ describe("core: buildScopedConditions", function () {
|
|
|
271
271
|
// Note: This would require both conditions to match, which isn't possible with same attribute
|
|
272
272
|
// So testing with different attributes that both match
|
|
273
273
|
expect(
|
|
274
|
-
|
|
275
|
-
|
|
274
|
+
applyContextToConditions(
|
|
275
|
+
featurevisor,
|
|
276
276
|
{
|
|
277
277
|
or: [
|
|
278
278
|
{
|
|
@@ -296,8 +296,8 @@ describe("core: buildScopedConditions", function () {
|
|
|
296
296
|
|
|
297
297
|
// OR with partial match (redundant "*" removed, but OR structure remains)
|
|
298
298
|
expect(
|
|
299
|
-
|
|
300
|
-
|
|
299
|
+
applyContextToConditions(
|
|
300
|
+
featurevisor,
|
|
301
301
|
{
|
|
302
302
|
or: [
|
|
303
303
|
{
|
|
@@ -328,8 +328,8 @@ describe("core: buildScopedConditions", function () {
|
|
|
328
328
|
|
|
329
329
|
// OR with no matches
|
|
330
330
|
expect(
|
|
331
|
-
|
|
332
|
-
|
|
331
|
+
applyContextToConditions(
|
|
332
|
+
featurevisor,
|
|
333
333
|
{
|
|
334
334
|
or: [
|
|
335
335
|
{
|
|
@@ -365,10 +365,10 @@ describe("core: buildScopedConditions", function () {
|
|
|
365
365
|
});
|
|
366
366
|
|
|
367
367
|
test("NOT conditions", function () {
|
|
368
|
-
// NOT with matching condition
|
|
368
|
+
// NOT with matching condition remains an always-false expression
|
|
369
369
|
expect(
|
|
370
|
-
|
|
371
|
-
|
|
370
|
+
applyContextToConditions(
|
|
371
|
+
featurevisor,
|
|
372
372
|
{
|
|
373
373
|
not: [
|
|
374
374
|
{
|
|
@@ -382,12 +382,14 @@ describe("core: buildScopedConditions", function () {
|
|
|
382
382
|
platform: "web",
|
|
383
383
|
},
|
|
384
384
|
),
|
|
385
|
-
).toEqual(
|
|
385
|
+
).toEqual({
|
|
386
|
+
not: ["*"],
|
|
387
|
+
});
|
|
386
388
|
|
|
387
389
|
// NOT with non-matching condition
|
|
388
390
|
expect(
|
|
389
|
-
|
|
390
|
-
|
|
391
|
+
applyContextToConditions(
|
|
392
|
+
featurevisor,
|
|
391
393
|
{
|
|
392
394
|
not: [
|
|
393
395
|
{
|
|
@@ -411,10 +413,10 @@ describe("core: buildScopedConditions", function () {
|
|
|
411
413
|
],
|
|
412
414
|
});
|
|
413
415
|
|
|
414
|
-
// NOT with multiple conditions
|
|
416
|
+
// NOT with multiple matching conditions remains an always-false expression
|
|
415
417
|
expect(
|
|
416
|
-
|
|
417
|
-
|
|
418
|
+
applyContextToConditions(
|
|
419
|
+
featurevisor,
|
|
418
420
|
{
|
|
419
421
|
not: [
|
|
420
422
|
{
|
|
@@ -434,14 +436,16 @@ describe("core: buildScopedConditions", function () {
|
|
|
434
436
|
browser: "chrome",
|
|
435
437
|
},
|
|
436
438
|
),
|
|
437
|
-
).toEqual(
|
|
439
|
+
).toEqual({
|
|
440
|
+
not: ["*"],
|
|
441
|
+
});
|
|
438
442
|
});
|
|
439
443
|
|
|
440
444
|
test("nested AND conditions", function () {
|
|
441
445
|
// Nested AND with all matching (all "*" becomes "*")
|
|
442
446
|
expect(
|
|
443
|
-
|
|
444
|
-
|
|
447
|
+
applyContextToConditions(
|
|
448
|
+
featurevisor,
|
|
445
449
|
{
|
|
446
450
|
and: [
|
|
447
451
|
{
|
|
@@ -475,8 +479,8 @@ describe("core: buildScopedConditions", function () {
|
|
|
475
479
|
|
|
476
480
|
// Nested AND with partial match (redundant "*" removed)
|
|
477
481
|
expect(
|
|
478
|
-
|
|
479
|
-
|
|
482
|
+
applyContextToConditions(
|
|
483
|
+
featurevisor,
|
|
480
484
|
{
|
|
481
485
|
and: [
|
|
482
486
|
{
|
|
@@ -523,8 +527,8 @@ describe("core: buildScopedConditions", function () {
|
|
|
523
527
|
test("nested OR conditions", function () {
|
|
524
528
|
// Nested OR with outer match (redundant "*" removed, but inner OR remains)
|
|
525
529
|
expect(
|
|
526
|
-
|
|
527
|
-
|
|
530
|
+
applyContextToConditions(
|
|
531
|
+
featurevisor,
|
|
528
532
|
{
|
|
529
533
|
or: [
|
|
530
534
|
{
|
|
@@ -573,8 +577,8 @@ describe("core: buildScopedConditions", function () {
|
|
|
573
577
|
|
|
574
578
|
// Nested OR with inner match (redundant "*" removed, but outer OR remains)
|
|
575
579
|
expect(
|
|
576
|
-
|
|
577
|
-
|
|
580
|
+
applyContextToConditions(
|
|
581
|
+
featurevisor,
|
|
578
582
|
{
|
|
579
583
|
or: [
|
|
580
584
|
{
|
|
@@ -623,10 +627,10 @@ describe("core: buildScopedConditions", function () {
|
|
|
623
627
|
});
|
|
624
628
|
|
|
625
629
|
test("nested NOT conditions", function () {
|
|
626
|
-
// Nested NOT
|
|
630
|
+
// Nested NOT preserves non-broadening false expressions
|
|
627
631
|
expect(
|
|
628
|
-
|
|
629
|
-
|
|
632
|
+
applyContextToConditions(
|
|
633
|
+
featurevisor,
|
|
630
634
|
{
|
|
631
635
|
not: [
|
|
632
636
|
{
|
|
@@ -650,14 +654,20 @@ describe("core: buildScopedConditions", function () {
|
|
|
650
654
|
browser: "chrome",
|
|
651
655
|
},
|
|
652
656
|
),
|
|
653
|
-
).toEqual(
|
|
657
|
+
).toEqual({
|
|
658
|
+
not: [
|
|
659
|
+
{
|
|
660
|
+
not: ["*"],
|
|
661
|
+
},
|
|
662
|
+
],
|
|
663
|
+
});
|
|
654
664
|
});
|
|
655
665
|
|
|
656
666
|
test("mixed nested conditions", function () {
|
|
657
667
|
// AND with nested OR (redundant "*" removed, but OR structure remains if not all match)
|
|
658
668
|
expect(
|
|
659
|
-
|
|
660
|
-
|
|
669
|
+
applyContextToConditions(
|
|
670
|
+
featurevisor,
|
|
661
671
|
{
|
|
662
672
|
and: [
|
|
663
673
|
{
|
|
@@ -702,8 +712,8 @@ describe("core: buildScopedConditions", function () {
|
|
|
702
712
|
|
|
703
713
|
// OR with nested AND (redundant "*" removed, but OR structure remains if not all match)
|
|
704
714
|
expect(
|
|
705
|
-
|
|
706
|
-
|
|
715
|
+
applyContextToConditions(
|
|
716
|
+
featurevisor,
|
|
707
717
|
{
|
|
708
718
|
or: [
|
|
709
719
|
{
|
|
@@ -744,8 +754,8 @@ describe("core: buildScopedConditions", function () {
|
|
|
744
754
|
|
|
745
755
|
// AND with nested NOT (redundant "*" removed)
|
|
746
756
|
expect(
|
|
747
|
-
|
|
748
|
-
|
|
757
|
+
applyContextToConditions(
|
|
758
|
+
featurevisor,
|
|
749
759
|
{
|
|
750
760
|
and: [
|
|
751
761
|
{
|
|
@@ -785,8 +795,8 @@ describe("core: buildScopedConditions", function () {
|
|
|
785
795
|
|
|
786
796
|
// Complex nested structure (redundant "*" removed)
|
|
787
797
|
expect(
|
|
788
|
-
|
|
789
|
-
|
|
798
|
+
applyContextToConditions(
|
|
799
|
+
featurevisor,
|
|
790
800
|
{
|
|
791
801
|
and: [
|
|
792
802
|
{
|
|
@@ -843,8 +853,8 @@ describe("core: buildScopedConditions", function () {
|
|
|
843
853
|
test("arrays with nested conditions", function () {
|
|
844
854
|
// Array with AND condition (redundant "*" removed)
|
|
845
855
|
expect(
|
|
846
|
-
|
|
847
|
-
|
|
856
|
+
applyContextToConditions(
|
|
857
|
+
featurevisor,
|
|
848
858
|
[
|
|
849
859
|
{
|
|
850
860
|
attribute: "platform",
|
|
@@ -876,8 +886,8 @@ describe("core: buildScopedConditions", function () {
|
|
|
876
886
|
|
|
877
887
|
// Array with OR condition (redundant "*" removed, but OR structure remains if not all match)
|
|
878
888
|
expect(
|
|
879
|
-
|
|
880
|
-
|
|
889
|
+
applyContextToConditions(
|
|
890
|
+
featurevisor,
|
|
881
891
|
[
|
|
882
892
|
{
|
|
883
893
|
attribute: "platform",
|
|
@@ -920,8 +930,8 @@ describe("core: buildScopedConditions", function () {
|
|
|
920
930
|
test("edge cases", function () {
|
|
921
931
|
// Empty context
|
|
922
932
|
expect(
|
|
923
|
-
|
|
924
|
-
|
|
933
|
+
applyContextToConditions(
|
|
934
|
+
featurevisor,
|
|
925
935
|
{
|
|
926
936
|
attribute: "platform",
|
|
927
937
|
operator: "equals",
|
|
@@ -936,12 +946,12 @@ describe("core: buildScopedConditions", function () {
|
|
|
936
946
|
});
|
|
937
947
|
|
|
938
948
|
// Empty array (all "*" becomes "*")
|
|
939
|
-
expect(
|
|
949
|
+
expect(applyContextToConditions(featurevisor, [], {})).toEqual("*");
|
|
940
950
|
|
|
941
951
|
// "*" in array with matching condition (all "*" becomes "*")
|
|
942
952
|
expect(
|
|
943
|
-
|
|
944
|
-
|
|
953
|
+
applyContextToConditions(
|
|
954
|
+
featurevisor,
|
|
945
955
|
[
|
|
946
956
|
"*",
|
|
947
957
|
{
|
|
@@ -958,8 +968,8 @@ describe("core: buildScopedConditions", function () {
|
|
|
958
968
|
|
|
959
969
|
// AND with empty array (all "*" becomes "*")
|
|
960
970
|
expect(
|
|
961
|
-
|
|
962
|
-
|
|
971
|
+
applyContextToConditions(
|
|
972
|
+
featurevisor,
|
|
963
973
|
{
|
|
964
974
|
and: [],
|
|
965
975
|
},
|
|
@@ -969,8 +979,8 @@ describe("core: buildScopedConditions", function () {
|
|
|
969
979
|
|
|
970
980
|
// OR with empty array (all "*" becomes "*")
|
|
971
981
|
expect(
|
|
972
|
-
|
|
973
|
-
|
|
982
|
+
applyContextToConditions(
|
|
983
|
+
featurevisor,
|
|
974
984
|
{
|
|
975
985
|
or: [],
|
|
976
986
|
},
|
|
@@ -980,19 +990,19 @@ describe("core: buildScopedConditions", function () {
|
|
|
980
990
|
});
|
|
981
991
|
});
|
|
982
992
|
|
|
983
|
-
describe("
|
|
984
|
-
test("
|
|
985
|
-
expect(
|
|
993
|
+
describe("applyContextToCondition (singular)", function () {
|
|
994
|
+
test("applyContextToCondition is a function", function () {
|
|
995
|
+
expect(applyContextToCondition).toBeInstanceOf(Function);
|
|
986
996
|
});
|
|
987
997
|
|
|
988
998
|
test("simple cases", function () {
|
|
989
999
|
// "*" remains "*"
|
|
990
|
-
expect(
|
|
1000
|
+
expect(applyContextToCondition(featurevisor, "*", {})).toEqual("*");
|
|
991
1001
|
|
|
992
1002
|
// Plain condition that matches
|
|
993
1003
|
expect(
|
|
994
|
-
|
|
995
|
-
|
|
1004
|
+
applyContextToCondition(
|
|
1005
|
+
featurevisor,
|
|
996
1006
|
{
|
|
997
1007
|
attribute: "platform",
|
|
998
1008
|
operator: "equals",
|
|
@@ -1006,8 +1016,8 @@ describe("core: buildScopedConditions", function () {
|
|
|
1006
1016
|
|
|
1007
1017
|
// Plain condition that doesn't match
|
|
1008
1018
|
expect(
|
|
1009
|
-
|
|
1010
|
-
|
|
1019
|
+
applyContextToCondition(
|
|
1020
|
+
featurevisor,
|
|
1011
1021
|
{
|
|
1012
1022
|
attribute: "platform",
|
|
1013
1023
|
operator: "equals",
|
|
@@ -1039,7 +1049,7 @@ describe("core: buildScopedConditions", function () {
|
|
|
1039
1049
|
|
|
1040
1050
|
// Partial match
|
|
1041
1051
|
expect(
|
|
1042
|
-
|
|
1052
|
+
applyContextToCondition(featurevisor, originalConditions, {
|
|
1043
1053
|
platform: "web",
|
|
1044
1054
|
}),
|
|
1045
1055
|
).toEqual([
|
|
@@ -1053,7 +1063,7 @@ describe("core: buildScopedConditions", function () {
|
|
|
1053
1063
|
|
|
1054
1064
|
// Full match
|
|
1055
1065
|
expect(
|
|
1056
|
-
|
|
1066
|
+
applyContextToCondition(featurevisor, originalConditions, {
|
|
1057
1067
|
platform: "web",
|
|
1058
1068
|
browser: "chrome",
|
|
1059
1069
|
}),
|
|
@@ -1061,7 +1071,7 @@ describe("core: buildScopedConditions", function () {
|
|
|
1061
1071
|
|
|
1062
1072
|
// No match
|
|
1063
1073
|
expect(
|
|
1064
|
-
|
|
1074
|
+
applyContextToCondition(featurevisor, originalConditions, {
|
|
1065
1075
|
platform: "mobile",
|
|
1066
1076
|
browser: "safari",
|
|
1067
1077
|
}),
|
|
@@ -1082,8 +1092,8 @@ describe("core: buildScopedConditions", function () {
|
|
|
1082
1092
|
test("AND conditions", function () {
|
|
1083
1093
|
// AND with all matching conditions
|
|
1084
1094
|
expect(
|
|
1085
|
-
|
|
1086
|
-
|
|
1095
|
+
applyContextToCondition(
|
|
1096
|
+
featurevisor,
|
|
1087
1097
|
{
|
|
1088
1098
|
and: [
|
|
1089
1099
|
{
|
|
@@ -1109,8 +1119,8 @@ describe("core: buildScopedConditions", function () {
|
|
|
1109
1119
|
|
|
1110
1120
|
// AND with partial match
|
|
1111
1121
|
expect(
|
|
1112
|
-
|
|
1113
|
-
|
|
1122
|
+
applyContextToCondition(
|
|
1123
|
+
featurevisor,
|
|
1114
1124
|
{
|
|
1115
1125
|
and: [
|
|
1116
1126
|
{
|
|
@@ -1142,8 +1152,8 @@ describe("core: buildScopedConditions", function () {
|
|
|
1142
1152
|
|
|
1143
1153
|
// AND with no matches
|
|
1144
1154
|
expect(
|
|
1145
|
-
|
|
1146
|
-
|
|
1155
|
+
applyContextToCondition(
|
|
1156
|
+
featurevisor,
|
|
1147
1157
|
{
|
|
1148
1158
|
and: [
|
|
1149
1159
|
{
|
|
@@ -1180,8 +1190,8 @@ describe("core: buildScopedConditions", function () {
|
|
|
1180
1190
|
|
|
1181
1191
|
// AND with "*" in it
|
|
1182
1192
|
expect(
|
|
1183
|
-
|
|
1184
|
-
|
|
1193
|
+
applyContextToCondition(
|
|
1194
|
+
featurevisor,
|
|
1185
1195
|
{
|
|
1186
1196
|
and: [
|
|
1187
1197
|
"*",
|
|
@@ -1204,8 +1214,8 @@ describe("core: buildScopedConditions", function () {
|
|
|
1204
1214
|
test("OR conditions", function () {
|
|
1205
1215
|
// OR with all matching conditions
|
|
1206
1216
|
expect(
|
|
1207
|
-
|
|
1208
|
-
|
|
1217
|
+
applyContextToCondition(
|
|
1218
|
+
featurevisor,
|
|
1209
1219
|
{
|
|
1210
1220
|
or: [
|
|
1211
1221
|
{
|
|
@@ -1230,8 +1240,8 @@ describe("core: buildScopedConditions", function () {
|
|
|
1230
1240
|
|
|
1231
1241
|
// OR with partial match (first matches)
|
|
1232
1242
|
expect(
|
|
1233
|
-
|
|
1234
|
-
|
|
1243
|
+
applyContextToCondition(
|
|
1244
|
+
featurevisor,
|
|
1235
1245
|
{
|
|
1236
1246
|
or: [
|
|
1237
1247
|
{
|
|
@@ -1263,8 +1273,8 @@ describe("core: buildScopedConditions", function () {
|
|
|
1263
1273
|
|
|
1264
1274
|
// OR with no matches
|
|
1265
1275
|
expect(
|
|
1266
|
-
|
|
1267
|
-
|
|
1276
|
+
applyContextToCondition(
|
|
1277
|
+
featurevisor,
|
|
1268
1278
|
{
|
|
1269
1279
|
or: [
|
|
1270
1280
|
{
|
|
@@ -1302,8 +1312,8 @@ describe("core: buildScopedConditions", function () {
|
|
|
1302
1312
|
test("NOT conditions", function () {
|
|
1303
1313
|
// NOT with matching condition (should not match)
|
|
1304
1314
|
expect(
|
|
1305
|
-
|
|
1306
|
-
|
|
1315
|
+
applyContextToCondition(
|
|
1316
|
+
featurevisor,
|
|
1307
1317
|
{
|
|
1308
1318
|
not: [
|
|
1309
1319
|
{
|
|
@@ -1323,8 +1333,8 @@ describe("core: buildScopedConditions", function () {
|
|
|
1323
1333
|
|
|
1324
1334
|
// NOT with non-matching condition
|
|
1325
1335
|
expect(
|
|
1326
|
-
|
|
1327
|
-
|
|
1336
|
+
applyContextToCondition(
|
|
1337
|
+
featurevisor,
|
|
1328
1338
|
{
|
|
1329
1339
|
not: [
|
|
1330
1340
|
{
|
|
@@ -1350,8 +1360,8 @@ describe("core: buildScopedConditions", function () {
|
|
|
1350
1360
|
|
|
1351
1361
|
// NOT with multiple conditions
|
|
1352
1362
|
expect(
|
|
1353
|
-
|
|
1354
|
-
|
|
1363
|
+
applyContextToCondition(
|
|
1364
|
+
featurevisor,
|
|
1355
1365
|
{
|
|
1356
1366
|
not: [
|
|
1357
1367
|
{
|
|
@@ -1379,8 +1389,8 @@ describe("core: buildScopedConditions", function () {
|
|
|
1379
1389
|
test("nested AND conditions", function () {
|
|
1380
1390
|
// Nested AND with all matching
|
|
1381
1391
|
expect(
|
|
1382
|
-
|
|
1383
|
-
|
|
1392
|
+
applyContextToCondition(
|
|
1393
|
+
featurevisor,
|
|
1384
1394
|
{
|
|
1385
1395
|
and: [
|
|
1386
1396
|
{
|
|
@@ -1421,8 +1431,8 @@ describe("core: buildScopedConditions", function () {
|
|
|
1421
1431
|
|
|
1422
1432
|
// Nested AND with partial match
|
|
1423
1433
|
expect(
|
|
1424
|
-
|
|
1425
|
-
|
|
1434
|
+
applyContextToCondition(
|
|
1435
|
+
featurevisor,
|
|
1426
1436
|
{
|
|
1427
1437
|
and: [
|
|
1428
1438
|
{
|
|
@@ -1471,8 +1481,8 @@ describe("core: buildScopedConditions", function () {
|
|
|
1471
1481
|
test("nested OR conditions", function () {
|
|
1472
1482
|
// Nested OR with matching
|
|
1473
1483
|
expect(
|
|
1474
|
-
|
|
1475
|
-
|
|
1484
|
+
applyContextToCondition(
|
|
1485
|
+
featurevisor,
|
|
1476
1486
|
{
|
|
1477
1487
|
or: [
|
|
1478
1488
|
{
|
|
@@ -1522,8 +1532,8 @@ describe("core: buildScopedConditions", function () {
|
|
|
1522
1532
|
|
|
1523
1533
|
// Nested OR with inner match
|
|
1524
1534
|
expect(
|
|
1525
|
-
|
|
1526
|
-
|
|
1535
|
+
applyContextToCondition(
|
|
1536
|
+
featurevisor,
|
|
1527
1537
|
{
|
|
1528
1538
|
or: [
|
|
1529
1539
|
{
|
|
@@ -1575,8 +1585,8 @@ describe("core: buildScopedConditions", function () {
|
|
|
1575
1585
|
test("nested NOT conditions", function () {
|
|
1576
1586
|
// Nested NOT
|
|
1577
1587
|
expect(
|
|
1578
|
-
|
|
1579
|
-
|
|
1588
|
+
applyContextToCondition(
|
|
1589
|
+
featurevisor,
|
|
1580
1590
|
{
|
|
1581
1591
|
not: [
|
|
1582
1592
|
{
|
|
@@ -1613,8 +1623,8 @@ describe("core: buildScopedConditions", function () {
|
|
|
1613
1623
|
test("mixed nested conditions", function () {
|
|
1614
1624
|
// AND with nested OR
|
|
1615
1625
|
expect(
|
|
1616
|
-
|
|
1617
|
-
|
|
1626
|
+
applyContextToCondition(
|
|
1627
|
+
featurevisor,
|
|
1618
1628
|
{
|
|
1619
1629
|
and: [
|
|
1620
1630
|
{
|
|
@@ -1661,8 +1671,8 @@ describe("core: buildScopedConditions", function () {
|
|
|
1661
1671
|
|
|
1662
1672
|
// OR with nested AND
|
|
1663
1673
|
expect(
|
|
1664
|
-
|
|
1665
|
-
|
|
1674
|
+
applyContextToCondition(
|
|
1675
|
+
featurevisor,
|
|
1666
1676
|
{
|
|
1667
1677
|
or: [
|
|
1668
1678
|
{
|
|
@@ -1706,8 +1716,8 @@ describe("core: buildScopedConditions", function () {
|
|
|
1706
1716
|
|
|
1707
1717
|
// AND with nested NOT
|
|
1708
1718
|
expect(
|
|
1709
|
-
|
|
1710
|
-
|
|
1719
|
+
applyContextToCondition(
|
|
1720
|
+
featurevisor,
|
|
1711
1721
|
{
|
|
1712
1722
|
and: [
|
|
1713
1723
|
{
|
|
@@ -1748,8 +1758,8 @@ describe("core: buildScopedConditions", function () {
|
|
|
1748
1758
|
|
|
1749
1759
|
// Complex nested structure
|
|
1750
1760
|
expect(
|
|
1751
|
-
|
|
1752
|
-
|
|
1761
|
+
applyContextToCondition(
|
|
1762
|
+
featurevisor,
|
|
1753
1763
|
{
|
|
1754
1764
|
and: [
|
|
1755
1765
|
{
|
|
@@ -1810,8 +1820,8 @@ describe("core: buildScopedConditions", function () {
|
|
|
1810
1820
|
test("arrays with nested conditions", function () {
|
|
1811
1821
|
// Array with AND condition
|
|
1812
1822
|
expect(
|
|
1813
|
-
|
|
1814
|
-
|
|
1823
|
+
applyContextToCondition(
|
|
1824
|
+
featurevisor,
|
|
1815
1825
|
[
|
|
1816
1826
|
{
|
|
1817
1827
|
attribute: "platform",
|
|
@@ -1848,8 +1858,8 @@ describe("core: buildScopedConditions", function () {
|
|
|
1848
1858
|
|
|
1849
1859
|
// Array with OR condition
|
|
1850
1860
|
expect(
|
|
1851
|
-
|
|
1852
|
-
|
|
1861
|
+
applyContextToCondition(
|
|
1862
|
+
featurevisor,
|
|
1853
1863
|
[
|
|
1854
1864
|
{
|
|
1855
1865
|
attribute: "platform",
|
|
@@ -1894,8 +1904,8 @@ describe("core: buildScopedConditions", function () {
|
|
|
1894
1904
|
test("edge cases", function () {
|
|
1895
1905
|
// Empty context
|
|
1896
1906
|
expect(
|
|
1897
|
-
|
|
1898
|
-
|
|
1907
|
+
applyContextToCondition(
|
|
1908
|
+
featurevisor,
|
|
1899
1909
|
{
|
|
1900
1910
|
attribute: "platform",
|
|
1901
1911
|
operator: "equals",
|
|
@@ -1910,12 +1920,12 @@ describe("core: buildScopedConditions", function () {
|
|
|
1910
1920
|
});
|
|
1911
1921
|
|
|
1912
1922
|
// Empty array
|
|
1913
|
-
expect(
|
|
1923
|
+
expect(applyContextToCondition(featurevisor, [], {})).toEqual([]);
|
|
1914
1924
|
|
|
1915
1925
|
// "*" in array
|
|
1916
1926
|
expect(
|
|
1917
|
-
|
|
1918
|
-
|
|
1927
|
+
applyContextToCondition(
|
|
1928
|
+
featurevisor,
|
|
1919
1929
|
[
|
|
1920
1930
|
"*",
|
|
1921
1931
|
{
|
|
@@ -1932,8 +1942,8 @@ describe("core: buildScopedConditions", function () {
|
|
|
1932
1942
|
|
|
1933
1943
|
// AND with empty array
|
|
1934
1944
|
expect(
|
|
1935
|
-
|
|
1936
|
-
|
|
1945
|
+
applyContextToCondition(
|
|
1946
|
+
featurevisor,
|
|
1937
1947
|
{
|
|
1938
1948
|
and: [],
|
|
1939
1949
|
},
|
|
@@ -1945,8 +1955,8 @@ describe("core: buildScopedConditions", function () {
|
|
|
1945
1955
|
|
|
1946
1956
|
// OR with empty array
|
|
1947
1957
|
expect(
|
|
1948
|
-
|
|
1949
|
-
|
|
1958
|
+
applyContextToCondition(
|
|
1959
|
+
featurevisor,
|
|
1950
1960
|
{
|
|
1951
1961
|
or: [],
|
|
1952
1962
|
},
|
|
@@ -2126,7 +2136,9 @@ describe("core: buildScopedConditions", function () {
|
|
|
2126
2136
|
|
|
2127
2137
|
test("NOT conditions", function () {
|
|
2128
2138
|
// All "*" in NOT
|
|
2129
|
-
expect(removeRedundantConditions({ not: ["*", "*", "*"] })).toEqual(
|
|
2139
|
+
expect(removeRedundantConditions({ not: ["*", "*", "*"] })).toEqual({
|
|
2140
|
+
not: ["*"],
|
|
2141
|
+
});
|
|
2130
2142
|
|
|
2131
2143
|
// Mixed with "*" in NOT
|
|
2132
2144
|
expect(
|
|
@@ -2299,7 +2311,13 @@ describe("core: buildScopedConditions", function () {
|
|
|
2299
2311
|
"*",
|
|
2300
2312
|
],
|
|
2301
2313
|
}),
|
|
2302
|
-
).toEqual(
|
|
2314
|
+
).toEqual({
|
|
2315
|
+
not: [
|
|
2316
|
+
{
|
|
2317
|
+
not: ["*"],
|
|
2318
|
+
},
|
|
2319
|
+
],
|
|
2320
|
+
});
|
|
2303
2321
|
|
|
2304
2322
|
// Nested NOT with mixed conditions
|
|
2305
2323
|
expect(
|