@molgenis/vip-report-template 6.2.0 → 7.0.0
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/.nvmrc +1 -1
- package/.travis.yml +8 -8
- package/README.md +411 -1
- package/eslint.config.mjs +11 -0
- package/package.json +40 -35
- package/scripts/deploy_npm_registry.sh +5 -0
- package/src/App.tsx +30 -24
- package/src/assets/sass/main.scss +12 -4
- package/src/components/Allele.tsx +95 -0
- package/src/components/Anchor.tsx +1 -1
- package/src/components/Breadcrumb.tsx +6 -4
- package/src/components/DatasetDropdown.tsx +12 -25
- package/src/components/ErrorNotification.tsx +9 -0
- package/src/components/GenomeBrowser.tsx +40 -23
- package/src/components/HpoTerm.tsx +1 -1
- package/src/components/{record/Pager.tsx → Pager.tsx} +21 -14
- package/src/components/RecordsPerPage.tsx +9 -7
- package/src/components/RecordsTable.tsx +130 -0
- package/src/components/SampleTable.tsx +70 -98
- package/src/components/SearchBox.tsx +8 -2
- package/src/components/Sort.tsx +28 -25
- package/src/components/Table.tsx +16 -0
- package/src/components/Tooltip.tsx +20 -0
- package/src/components/VariantBreadcrumb.tsx +54 -0
- package/src/components/VariantConsequenceContainer.tsx +100 -0
- package/src/components/VariantConsequenceTable.tsx +58 -0
- package/src/components/VariantContainer.tsx +71 -0
- package/src/components/VariantFilters.tsx +27 -0
- package/src/components/VariantGenotypeTable.tsx +44 -0
- package/src/components/VariantInfoTable.tsx +24 -33
- package/src/components/VariantResults.tsx +103 -0
- package/src/components/VariantTable.tsx +62 -66
- package/src/components/VariantTypeSelect.tsx +34 -0
- package/src/components/VariantsContainer.tsx +150 -0
- package/src/components/VariantsContainerHeader.tsx +70 -0
- package/src/components/field/Field.tsx +80 -0
- package/src/components/field/FieldAlt.tsx +19 -0
- package/src/components/field/FieldChrom.tsx +6 -0
- package/src/components/{record/Id.tsx → field/FieldFilter.tsx} +2 -1
- package/src/components/field/FieldFormat.tsx +10 -0
- package/src/components/{record/Filter.tsx → field/FieldId.tsx} +1 -1
- package/src/components/field/FieldPos.tsx +6 -0
- package/src/components/field/FieldQual.tsx +6 -0
- package/src/components/field/FieldRef.tsx +8 -0
- package/src/components/field/composed/FieldClinVar.tsx +72 -0
- package/src/components/field/composed/FieldComposed.tsx +68 -0
- package/src/components/field/composed/FieldGene.tsx +39 -0
- package/src/components/field/composed/FieldGenotype.tsx +35 -0
- package/src/components/{record/format/GenotypeField.tsx → field/composed/FieldGenotypeSnvSv.tsx} +20 -16
- package/src/components/field/composed/FieldGenotypeStr.tsx +31 -0
- package/src/components/field/composed/FieldGnomAd.tsx +58 -0
- package/src/components/field/composed/FieldHpo.tsx +50 -0
- package/src/components/field/composed/FieldInheritanceModes.tsx +32 -0
- package/src/components/field/composed/FieldLocus.tsx +18 -0
- package/src/components/field/composed/FieldVipC.tsx +25 -0
- package/src/components/field/composed/FieldVipCS.tsx +15 -0
- package/src/components/field/composed/FieldVkgl.tsx +37 -0
- package/src/components/field/genotype/FieldGenotype.tsx +19 -0
- package/src/components/field/genotype/FieldGenotypeType.tsx +9 -0
- package/src/components/field/info/FieldConsequence.tsx +15 -0
- package/src/components/{record/info/Hgvs.tsx → field/info/FieldHgvs.tsx} +4 -6
- package/src/components/field/info/FieldInfo.tsx +27 -0
- package/src/components/{record/info/PubMed.tsx → field/info/FieldPubMed.tsx} +4 -7
- package/src/components/field/typed/FieldCategorical.tsx +17 -0
- package/src/components/{record/field/FieldValueCharacter.tsx → field/typed/FieldCharacter.tsx} +3 -2
- package/src/components/{record/field/FieldValueFlag.tsx → field/typed/FieldFlag.tsx} +3 -2
- package/src/components/{record/field/FieldValueFloat.tsx → field/typed/FieldFloat.tsx} +3 -2
- package/src/components/{record/field/FieldValueInteger.tsx → field/typed/FieldInteger.tsx} +3 -2
- package/src/components/{record/field/FieldValueString.tsx → field/typed/FieldString.tsx} +3 -2
- package/src/components/field/typed/FieldTyped.tsx +20 -0
- package/src/components/field/typed/FieldTypedItem.tsx +49 -0
- package/src/components/field/typed/FieldTypedMultiple.tsx +21 -0
- package/src/components/filter/Filter.tsx +56 -48
- package/src/components/filter/FilterWrapper.scss +23 -0
- package/src/components/filter/FilterWrapper.tsx +63 -0
- package/src/components/filter/composed/FilterAllelicImbalance.tsx +26 -0
- package/src/components/filter/composed/FilterComposed.tsx +92 -0
- package/src/components/filter/composed/FilterDeNovo.tsx +35 -0
- package/src/components/filter/composed/FilterHpo.tsx +16 -0
- package/src/components/filter/composed/FilterInheritance.tsx +42 -0
- package/src/components/filter/composed/FilterLocus.tsx +75 -0
- package/src/components/filter/composed/FilterVipC.tsx +16 -0
- package/src/components/filter/composed/FilterVipCS.tsx +16 -0
- package/src/components/filter/fixed/FilterAlt.tsx +20 -0
- package/src/components/filter/fixed/FilterChrom.tsx +22 -0
- package/src/components/filter/fixed/FilterFilter.tsx +20 -0
- package/src/components/filter/fixed/FilterFixed.tsx +96 -0
- package/src/components/filter/fixed/FilterId.tsx +20 -0
- package/src/components/filter/fixed/FilterPos.tsx +22 -0
- package/src/components/filter/fixed/FilterQual.tsx +21 -0
- package/src/components/filter/fixed/FilterRef.tsx +22 -0
- package/src/components/filter/typed/FilterCategorical.tsx +119 -0
- package/src/components/filter/typed/FilterFlag.tsx +23 -0
- package/src/components/filter/typed/FilterInterval.tsx +72 -0
- package/src/components/filter/typed/FilterString.tsx +43 -0
- package/src/components/filter/typed/FilterTyped.tsx +56 -0
- package/src/components/form/ButtonApply.tsx +11 -0
- package/src/components/form/ButtonDownload.tsx +11 -0
- package/src/components/form/ButtonReset.tsx +9 -0
- package/src/components/{Checkbox.tsx → form/Checkbox.tsx} +4 -9
- package/src/components/form/Input.tsx +19 -0
- package/src/components/form/Select.scss +7 -0
- package/src/components/form/Select.tsx +34 -0
- package/src/components/tree/DecisionTreeBoolMultiQuery.tsx +1 -1
- package/src/components/tree/DecisionTreeBoolQuery.tsx +1 -1
- package/src/components/tree/DecisionTreeNode.tsx +41 -39
- package/src/components/tree/DecisionTreeNodeBool.tsx +1 -1
- package/src/components/tree/DecisionTreeNodeBoolMulti.tsx +1 -1
- package/src/components/tree/DecisionTreeNodeCategorical.tsx +1 -1
- package/src/components/tree/DecisionTreeNodeExists.tsx +1 -1
- package/src/components/tree/DecisionTreeNodeLeaf.tsx +1 -1
- package/src/components/tree/DecisionTreeOutcomeNode.tsx +1 -1
- package/src/components/tree/DecisionTreePath.tsx +1 -1
- package/src/igv.d.ts +2 -1
- package/src/index.tsx +48 -19
- package/src/mocks/GRCh37/decisionTree.json +23 -22
- package/src/mocks/GRCh37/field_metadata.json +435 -95
- package/src/mocks/GRCh37/sampleTree.json +21 -1
- package/src/mocks/GRCh37/static.ts +62 -134
- package/src/mocks/GRCh37/vcf/family.vcf.blob +9 -3
- package/src/mocks/GRCh38/decisionTree.json +52 -33
- package/src/mocks/GRCh38/decisionTreeStr.json +572 -0
- package/src/mocks/GRCh38/fasta/chr1_149380406-149403321.fasta.gz.blob +0 -0
- package/src/mocks/GRCh38/field_metadata.json +435 -95
- package/src/mocks/GRCh38/sampleTree.json +175 -0
- package/src/mocks/GRCh38/static.ts +101 -42
- package/src/mocks/GRCh38/str.cram.blob +0 -0
- package/src/mocks/GRCh38/str.cram.crai.blob +0 -0
- package/src/mocks/GRCh38/vcf/family.vcf.blob +25 -24
- package/src/mocks/GRCh38/vcf/no_vep.vcf.blob +29 -28
- package/src/mocks/GRCh38/vcf/samples_0.vcf.blob +28 -27
- package/src/mocks/GRCh38/vcf/samples_1.vcf.blob +29 -28
- package/src/mocks/GRCh38/vcf/samples_100.vcf.blob +28 -27
- package/src/mocks/GRCh38/vcf/str.vcf.blob +321 -0
- package/src/mocks/MockApiClient.ts +339 -332
- package/src/mocks/config_cram.json +701 -0
- package/src/mocks/config_vcf.json +699 -0
- package/src/store/app.ts +30 -0
- package/src/store/index.tsx +3 -168
- package/src/store/variants.ts +182 -0
- package/src/types/config.d.ts +190 -0
- package/src/types/configCellComposed.d.ts +86 -0
- package/src/types/configCells.d.ts +129 -0
- package/src/types/configFilter.d.ts +80 -0
- package/src/types/configFilterComposed.d.ts +60 -0
- package/src/types/configSort.d.ts +13 -0
- package/src/types/filter.d.ts +17 -0
- package/src/types/store.d.ts +34 -0
- package/src/utils/api.ts +281 -0
- package/src/utils/config/config.ts +182 -0
- package/src/utils/config/configCells.ts +74 -0
- package/src/utils/config/configCellsComposed.ts +508 -0
- package/src/utils/config/configCellsField.ts +61 -0
- package/src/utils/config/configCellsFixed.ts +126 -0
- package/src/utils/config/configFilters.ts +46 -0
- package/src/utils/config/configFiltersComposed.ts +208 -0
- package/src/utils/config/configFiltersField.ts +49 -0
- package/src/utils/config/configFiltersFixed.ts +106 -0
- package/src/utils/config/configSorts.ts +44 -0
- package/src/utils/config/configValidator.ts +380 -0
- package/src/utils/config/configVip.ts +25 -0
- package/src/utils/csq.ts +115 -0
- package/src/utils/decisionTree.ts +45 -0
- package/src/utils/download.ts +30 -0
- package/src/utils/error.ts +69 -0
- package/src/utils/query/query.ts +55 -0
- package/src/utils/query/queryFilter.ts +132 -0
- package/src/utils/query/queryFilterComposed.ts +247 -0
- package/src/utils/query/queryFilterField.ts +75 -0
- package/src/utils/query/queryFilterFixed.ts +44 -0
- package/src/utils/query/querySample.ts +18 -0
- package/src/utils/query/queryVariantType.ts +76 -0
- package/src/utils/query/selector.ts +41 -0
- package/src/utils/{sortUtils.ts → query/sort.ts} +32 -11
- package/src/utils/sample.ts +19 -35
- package/src/utils/utils.ts +66 -2
- package/src/utils/variantType.ts +43 -0
- package/src/utils/vcf.ts +352 -0
- package/src/views/Help.tsx +109 -114
- package/src/views/Home.tsx +3 -2
- package/src/views/Sample.tsx +12 -7
- package/src/views/SampleVariant.tsx +23 -112
- package/src/views/SampleVariantConsequence.tsx +54 -144
- package/src/views/SampleVariants.tsx +33 -445
- package/src/views/SampleVariantsRedirect.tsx +20 -0
- package/src/views/Samples.tsx +7 -10
- package/src/views/Variant.tsx +31 -61
- package/src/views/VariantConsequence.tsx +42 -72
- package/src/views/Variants.tsx +29 -138
- package/src/views/VariantsRedirect.tsx +25 -0
- package/src/views/data/data.tsx +32 -6
- package/tests/store/variants.test.ts +122 -0
- package/tests/utils/config/config.test.ts +167 -0
- package/tests/utils/config/configCells.test.ts +86 -0
- package/tests/utils/config/configCellsComposed.test.ts +1163 -0
- package/tests/utils/config/configCellsField.test.ts +164 -0
- package/tests/utils/config/configCellsFixed.test.ts +99 -0
- package/tests/utils/config/configFilters.test.ts +80 -0
- package/tests/utils/config/configFiltersComposed.test.ts +504 -0
- package/tests/utils/config/configFiltersField.test.ts +140 -0
- package/tests/utils/config/configFiltersFixed.test.ts +81 -0
- package/tests/utils/config/configSorts.test.ts +55 -0
- package/tests/utils/config/configValidator.test.ts +56 -0
- package/tests/utils/config/configVip.test.ts +53 -0
- package/tests/utils/decisionTree.test.ts +71 -0
- package/tests/utils/download.test.ts +20 -0
- package/tests/utils/query/query.test.ts +84 -0
- package/tests/utils/query/queryFilter.test.ts +243 -0
- package/tests/utils/query/queryFilterComposed.test.ts +301 -0
- package/tests/utils/query/queryFilterField.test.ts +75 -0
- package/tests/utils/query/queryFilterFixed.test.ts +86 -0
- package/tests/utils/query/querySample.test.ts +45 -0
- package/tests/utils/query/queryVariantType.test.ts +56 -0
- package/{src/__tests__/sortUtils.test.ts → tests/utils/query/sort.test.ts} +3 -4
- package/tests/utils/sample.test.ts +259 -0
- package/tests/utils/utils.test.ts +120 -0
- package/tests/utils/variantType.test.ts +48 -0
- package/tests/utils/vcf.test.ts +649 -0
- package/tsconfig.json +6 -2
- package/vite.config.mts +20 -3
- package/.eslintignore +0 -4
- package/.eslintrc.js +0 -23
- package/src/Api.ts +0 -12
- package/src/__tests__/decisionTreeUtils.test.ts +0 -75
- package/src/__tests__/field.test.ts +0 -107
- package/src/__tests__/query.test.ts +0 -188
- package/src/__tests__/sample.test.ts +0 -184
- package/src/__tests__/utils.test.ts +0 -24
- package/src/__tests__/viewUtils.test.ts +0 -125
- package/src/components/ConsequenceTable.tsx +0 -45
- package/src/components/Error.tsx +0 -9
- package/src/components/FieldHeader.tsx +0 -26
- package/src/components/InfoCollapsablePane.tsx +0 -90
- package/src/components/VariantInfoNestedTable.tsx +0 -127
- package/src/components/VariantSampleTable.tsx +0 -58
- package/src/components/VariantsSampleTable.tsx +0 -184
- package/src/components/VariantsTable.tsx +0 -125
- package/src/components/filter/FilterAllelicBalance.tsx +0 -81
- package/src/components/filter/FilterCategorical.tsx +0 -81
- package/src/components/filter/FilterClinVar.tsx +0 -21
- package/src/components/filter/FilterGene.tsx +0 -34
- package/src/components/filter/FilterHpo.tsx +0 -161
- package/src/components/filter/FilterInheritance.tsx +0 -162
- package/src/components/filter/FilterIntegerGq.tsx +0 -47
- package/src/components/filter/FilterVI.tsx +0 -68
- package/src/components/filter/FilterVariantType.tsx +0 -146
- package/src/components/filter/Filters.tsx +0 -29
- package/src/components/filter/InfoFilter.tsx +0 -39
- package/src/components/filter/InfoFilters.tsx +0 -35
- package/src/components/filter/SampleFilters.tsx +0 -93
- package/src/components/filter/SamplesFilters.tsx +0 -33
- package/src/components/record/Allele.tsx +0 -38
- package/src/components/record/AlleleBreakend.tsx +0 -5
- package/src/components/record/AlleleMissing.tsx +0 -5
- package/src/components/record/AlleleNucs.tsx +0 -49
- package/src/components/record/AlleleSymbolic.tsx +0 -5
- package/src/components/record/Alt.tsx +0 -17
- package/src/components/record/Chrom.tsx +0 -5
- package/src/components/record/Format.tsx +0 -40
- package/src/components/record/Info.tsx +0 -55
- package/src/components/record/Pos.tsx +0 -5
- package/src/components/record/Qual.tsx +0 -5
- package/src/components/record/RecordDownload.tsx +0 -66
- package/src/components/record/Ref.tsx +0 -6
- package/src/components/record/field/Field.tsx +0 -36
- package/src/components/record/field/FieldMultipleValue.tsx +0 -22
- package/src/components/record/field/FieldSingleValue.tsx +0 -35
- package/src/components/record/info/ClinVar.tsx +0 -81
- package/src/components/record/info/Consequence.tsx +0 -18
- package/src/components/record/info/Gene.tsx +0 -56
- package/src/components/record/info/GnomAD.tsx +0 -54
- package/src/components/record/info/Hpo.tsx +0 -52
- package/src/components/record/info/InheritanceModes.tsx +0 -22
- package/src/components/record/info/VipC.tsx +0 -23
- package/src/components/record/info/Vkgl.tsx +0 -42
- package/src/mocks/GRCh37/vcf/no_vep.vcf.blob +0 -61
- package/src/mocks/GRCh37/vcf/samples_0.vcf.blob +0 -93
- package/src/mocks/GRCh37/vcf/samples_1.vcf.blob +0 -93
- package/src/mocks/GRCh37/vcf/samples_100.vcf.blob +0 -93
- package/src/utils/ApiUtils.ts +0 -263
- package/src/utils/csqUtils.ts +0 -27
- package/src/utils/decisionTreeUtils.ts +0 -31
- package/src/utils/field.ts +0 -49
- package/src/utils/query.ts +0 -154
- package/src/utils/viewUtils.ts +0 -32
package/vite.config.mts
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
import { defineConfig } from "vitest/config";
|
|
1
|
+
import { coverageConfigDefaults, defineConfig } from "vitest/config";
|
|
2
2
|
import solidPlugin from "vite-plugin-solid";
|
|
3
3
|
import inlinePlugin from "@molgenis/vite-plugin-inline";
|
|
4
4
|
|
|
5
|
-
export default defineConfig({
|
|
5
|
+
export default defineConfig(({ command }) => ({
|
|
6
6
|
plugins: [solidPlugin(), inlinePlugin()],
|
|
7
7
|
esbuild: {
|
|
8
8
|
// @molgenis/vite-plugin-inline requires ascii input and cannot handle UTF-8 input
|
|
9
9
|
charset: "ascii",
|
|
10
|
+
pure: command === "build" ? ["console.log"] : [],
|
|
10
11
|
},
|
|
11
12
|
build: {
|
|
13
|
+
modulePreload: false,
|
|
14
|
+
reportCompressedSize: false,
|
|
12
15
|
// inline plugin build options
|
|
13
16
|
rollupOptions: {
|
|
14
17
|
input: ["./index.html", "./node_modules/@molgenis/vite-plugin-inline/dist/loader.mjs"],
|
|
@@ -18,4 +21,18 @@ export default defineConfig({
|
|
|
18
21
|
},
|
|
19
22
|
},
|
|
20
23
|
assetsInclude: "**/*.blob",
|
|
21
|
-
|
|
24
|
+
test: {
|
|
25
|
+
coverage: {
|
|
26
|
+
include: ["src/**"],
|
|
27
|
+
exclude: [...coverageConfigDefaults.exclude, "src/mocks/**"],
|
|
28
|
+
// TODO add .tsx once component tests are added
|
|
29
|
+
extension: [".ts"],
|
|
30
|
+
thresholds: {
|
|
31
|
+
branches: 80,
|
|
32
|
+
lines: 80,
|
|
33
|
+
functions: 80,
|
|
34
|
+
statements: 80,
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
}));
|
package/.eslintignore
DELETED
package/.eslintrc.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
parser: "@typescript-eslint/parser",
|
|
3
|
-
parserOptions: {
|
|
4
|
-
project: ["./tsconfig.json"],
|
|
5
|
-
ecmaVersion: 2021,
|
|
6
|
-
sourceType: "module",
|
|
7
|
-
ecmaFeatures: {
|
|
8
|
-
jsx: true,
|
|
9
|
-
},
|
|
10
|
-
},
|
|
11
|
-
extends: [
|
|
12
|
-
"plugin:@typescript-eslint/recommended",
|
|
13
|
-
"plugin:@typescript-eslint/recommended-requiring-type-checking",
|
|
14
|
-
"prettier",
|
|
15
|
-
"plugin:prettier/recommended",
|
|
16
|
-
"plugin:solid/typescript",
|
|
17
|
-
],
|
|
18
|
-
rules: {
|
|
19
|
-
"@typescript-eslint/no-non-null-assertion": "off",
|
|
20
|
-
"solid/prefer-show": "off",
|
|
21
|
-
},
|
|
22
|
-
plugins: ["prettier", "@typescript-eslint"],
|
|
23
|
-
};
|
package/src/Api.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { WindowApiClient } from "@molgenis/vip-report-api/src/WindowApiClient";
|
|
2
|
-
|
|
3
|
-
// lazy import MockApiClient to ensure that it is excluded from the build artifact
|
|
4
|
-
const api = import.meta.env.PROD
|
|
5
|
-
? new WindowApiClient()
|
|
6
|
-
: await (function () {
|
|
7
|
-
return import("./mocks/MockApiClient").then((module) => {
|
|
8
|
-
return new module.MockApiClient();
|
|
9
|
-
});
|
|
10
|
-
})();
|
|
11
|
-
|
|
12
|
-
export default api;
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { expect, test } from "vitest";
|
|
2
|
-
import { getDecisionTreePath } from "../utils/decisionTreeUtils";
|
|
3
|
-
import { Item } from "@molgenis/vip-report-api/src/Api";
|
|
4
|
-
import { Record } from "@molgenis/vip-report-vcf/src/Vcf";
|
|
5
|
-
import { FieldMetadata } from "@molgenis/vip-report-vcf/src/MetadataParser";
|
|
6
|
-
|
|
7
|
-
test("Get DecisionTree Path", () => {
|
|
8
|
-
const fieldMetaVIPP: FieldMetadata = {
|
|
9
|
-
description: "VIP Decision tree path",
|
|
10
|
-
id: "VIPP",
|
|
11
|
-
number: { type: "NUMBER" },
|
|
12
|
-
type: "STRING",
|
|
13
|
-
};
|
|
14
|
-
const fieldMetaOther: FieldMetadata = {
|
|
15
|
-
description: "Other",
|
|
16
|
-
id: "Other",
|
|
17
|
-
number: { type: "NUMBER" },
|
|
18
|
-
type: "STRING",
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
const fieldMetaCsq: FieldMetadata = {
|
|
22
|
-
description: "VEP",
|
|
23
|
-
id: "CSQ",
|
|
24
|
-
number: { type: "NUMBER" },
|
|
25
|
-
type: "STRING",
|
|
26
|
-
nested: { items: [fieldMetaOther, fieldMetaVIPP], separator: "|" },
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
const variant: Item<Record> = {
|
|
30
|
-
data: {
|
|
31
|
-
a: [],
|
|
32
|
-
c: "",
|
|
33
|
-
f: [],
|
|
34
|
-
i: [],
|
|
35
|
-
n: {
|
|
36
|
-
CSQ: [["T", "gnomad&mvl&clinvar&exit", "MODERATE"]],
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
} as unknown as Item<Record>;
|
|
40
|
-
expect(getDecisionTreePath({ info: { CSQ: fieldMetaCsq }, lines: [], format: {}, samples: [] }, variant, 0)).toBe(
|
|
41
|
-
"gnomad&mvl&clinvar&exit",
|
|
42
|
-
);
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
test("Get DecisionTree Path - no VIPP", () => {
|
|
46
|
-
const fieldMetaOther: FieldMetadata = {
|
|
47
|
-
description: "Other",
|
|
48
|
-
id: "Other",
|
|
49
|
-
number: { type: "NUMBER" },
|
|
50
|
-
type: "STRING",
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
const fieldMetaCsq: FieldMetadata = {
|
|
54
|
-
description: "VEP",
|
|
55
|
-
id: "CSQ",
|
|
56
|
-
number: { type: "NUMBER" },
|
|
57
|
-
type: "STRING",
|
|
58
|
-
nested: { items: [fieldMetaOther], separator: "|" },
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
const variant: Item<Record> = {
|
|
62
|
-
data: {
|
|
63
|
-
a: [],
|
|
64
|
-
c: "",
|
|
65
|
-
f: [],
|
|
66
|
-
i: [],
|
|
67
|
-
n: {
|
|
68
|
-
CSQ: [["T", "gnomad&mvl&clinvar&exit", "MODERATE"]],
|
|
69
|
-
},
|
|
70
|
-
},
|
|
71
|
-
} as unknown as Item<Record>;
|
|
72
|
-
expect(getDecisionTreePath({ info: { CSQ: fieldMetaCsq }, lines: [], format: {}, samples: [] }, variant, 0)).toBe(
|
|
73
|
-
undefined,
|
|
74
|
-
);
|
|
75
|
-
});
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test } from "vitest";
|
|
2
|
-
import { abbreviateHeader, findInfoField, isNumerical } from "../utils/field";
|
|
3
|
-
import { FieldMetadata } from "@molgenis/vip-report-vcf/src/MetadataParser";
|
|
4
|
-
import { Metadata } from "@molgenis/vip-report-vcf/src/Vcf";
|
|
5
|
-
import { FieldMetadataContainer } from "@molgenis/vip-report-vcf/src/VcfParser";
|
|
6
|
-
|
|
7
|
-
describe("field utilities", () => {
|
|
8
|
-
test("FLOAT is numerical", () => {
|
|
9
|
-
expect(isNumerical({ type: "FLOAT" } as FieldMetadata)).toBe(true);
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
test("INTEGER is numerical", () => {
|
|
13
|
-
expect(isNumerical({ type: "INTEGER" } as FieldMetadata)).toBe(true);
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
test("STRING is not numerical", () => {
|
|
17
|
-
expect(isNumerical({ type: "STRING" } as FieldMetadata)).toBe(false);
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
test("abbreviate header long text", () => {
|
|
21
|
-
expect(abbreviateHeader("abcdefghijklmnopqrstuvwxyz")).toBe("abcdefghijk\u2026");
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
test("abbreviate header short text", () => {
|
|
25
|
-
expect(abbreviateHeader("abcdef")).toBe("abcdef");
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
test("find info field", () => {
|
|
29
|
-
const field = { id: "field" } as FieldMetadata;
|
|
30
|
-
const recordsMetadata = {
|
|
31
|
-
info: {
|
|
32
|
-
field,
|
|
33
|
-
} as FieldMetadataContainer,
|
|
34
|
-
} as Metadata;
|
|
35
|
-
|
|
36
|
-
expect(findInfoField(recordsMetadata, ["n", "field"])).toBe(field);
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
test("find info field: unknown field", () => {
|
|
40
|
-
const recordsMetadata = {
|
|
41
|
-
info: {} as FieldMetadataContainer,
|
|
42
|
-
} as Metadata;
|
|
43
|
-
|
|
44
|
-
expect(() => findInfoField(recordsMetadata, ["n", "field"])).toThrowError();
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
test("find info field: nested", () => {
|
|
48
|
-
const childField0 = { id: "childField0" } as FieldMetadata;
|
|
49
|
-
const childField1 = { id: "childField1" } as FieldMetadata;
|
|
50
|
-
const nestedField = { id: "nestedField", nested: { items: [childField0, childField1] } } as FieldMetadata;
|
|
51
|
-
|
|
52
|
-
const recordsMetadata = {
|
|
53
|
-
info: {
|
|
54
|
-
nestedField,
|
|
55
|
-
} as FieldMetadataContainer,
|
|
56
|
-
} as Metadata;
|
|
57
|
-
|
|
58
|
-
expect(findInfoField(recordsMetadata, ["n", "nestedField", 1])).toBe(childField1);
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
test("find info field: missing 'n' path item", () => {
|
|
62
|
-
const field = { id: "field" } as FieldMetadata;
|
|
63
|
-
const recordsMetadata = {
|
|
64
|
-
info: {
|
|
65
|
-
field,
|
|
66
|
-
} as FieldMetadataContainer,
|
|
67
|
-
} as Metadata;
|
|
68
|
-
|
|
69
|
-
expect(() => findInfoField(recordsMetadata, ["field"])).toThrowError();
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
test("find info field: missing 'n' path item nested", () => {
|
|
73
|
-
const recordsMetadata = {
|
|
74
|
-
info: {} as FieldMetadataContainer,
|
|
75
|
-
} as Metadata;
|
|
76
|
-
|
|
77
|
-
expect(() => findInfoField(recordsMetadata, ["nestedField", 1])).toThrowError();
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
test("find info field: nested invalid index", () => {
|
|
81
|
-
const childField0 = { id: "childField0" } as FieldMetadata;
|
|
82
|
-
const childField1 = { id: "childField1" } as FieldMetadata;
|
|
83
|
-
const nestedField = { id: "nestedField", nested: { items: [childField0, childField1] } } as FieldMetadata;
|
|
84
|
-
|
|
85
|
-
const recordsMetadata = {
|
|
86
|
-
info: {
|
|
87
|
-
nestedField,
|
|
88
|
-
} as FieldMetadataContainer,
|
|
89
|
-
} as Metadata;
|
|
90
|
-
|
|
91
|
-
expect(() => findInfoField(recordsMetadata, ["n", "nestedField", 2])).toThrowError();
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
test("find info field: nested invalid index type", () => {
|
|
95
|
-
const childField0 = { id: "childField0" } as FieldMetadata;
|
|
96
|
-
const childField1 = { id: "childField1" } as FieldMetadata;
|
|
97
|
-
const nestedField = { id: "nestedField", nested: { items: [childField0, childField1] } } as FieldMetadata;
|
|
98
|
-
|
|
99
|
-
const recordsMetadata = {
|
|
100
|
-
info: {
|
|
101
|
-
nestedField,
|
|
102
|
-
} as FieldMetadataContainer,
|
|
103
|
-
} as Metadata;
|
|
104
|
-
|
|
105
|
-
expect(() => findInfoField(recordsMetadata, ["n", "nestedField", "childField1"])).toThrowError();
|
|
106
|
-
});
|
|
107
|
-
});
|
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test } from "vitest";
|
|
2
|
-
import { FieldMetadata } from "@molgenis/vip-report-vcf/src/MetadataParser";
|
|
3
|
-
import { Metadata } from "@molgenis/vip-report-vcf/src/Vcf";
|
|
4
|
-
import { FilterQueries } from "../store";
|
|
5
|
-
import {
|
|
6
|
-
createQuery,
|
|
7
|
-
createSampleQuery,
|
|
8
|
-
infoFieldKey,
|
|
9
|
-
infoSelector,
|
|
10
|
-
infoSortPath,
|
|
11
|
-
sampleFieldKey,
|
|
12
|
-
sampleSelector,
|
|
13
|
-
selectorKey,
|
|
14
|
-
} from "../utils/query";
|
|
15
|
-
import { Item, Person, Query, QueryClause, Sample } from "@molgenis/vip-report-api/src/Api";
|
|
16
|
-
|
|
17
|
-
describe("query utilities", () => {
|
|
18
|
-
let fieldMetaCsq: FieldMetadata = {
|
|
19
|
-
id: "CSQ",
|
|
20
|
-
number: { type: "NUMBER" },
|
|
21
|
-
type: "STRING",
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
const fieldMeta1: FieldMetadata = {
|
|
25
|
-
id: "field1",
|
|
26
|
-
number: { type: "NUMBER" },
|
|
27
|
-
type: "CATEGORICAL",
|
|
28
|
-
parent: fieldMetaCsq,
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
const fieldMeta2: FieldMetadata = {
|
|
32
|
-
id: "field2",
|
|
33
|
-
number: { type: "NUMBER" },
|
|
34
|
-
type: "CATEGORICAL",
|
|
35
|
-
parent: fieldMetaCsq,
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
fieldMetaCsq = {
|
|
39
|
-
id: "CSQ",
|
|
40
|
-
number: { type: "NUMBER" },
|
|
41
|
-
type: "STRING",
|
|
42
|
-
nested: { items: [fieldMeta1, fieldMeta2], separator: "|" },
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
const person: Person = {
|
|
46
|
-
familyId: "FAM001",
|
|
47
|
-
individualId: "Patient",
|
|
48
|
-
sex: "FEMALE",
|
|
49
|
-
affectedStatus: "AFFECTED",
|
|
50
|
-
maternalId: "Mother",
|
|
51
|
-
paternalId: "Father",
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
const meta: Metadata = { info: { CSQ: fieldMetaCsq } } as unknown as Metadata;
|
|
55
|
-
|
|
56
|
-
test("create sample query - filters", () => {
|
|
57
|
-
const sample = { data: { index: 1 } } as Item<Sample>;
|
|
58
|
-
const queryClause: Query = {
|
|
59
|
-
operator: "and",
|
|
60
|
-
args: [
|
|
61
|
-
{ selector: ["s", 1, "GT", "t"], operator: "!=", args: "hom_r" },
|
|
62
|
-
{ selector: ["s", 1, "GT", "t"], operator: "!=", args: "miss" },
|
|
63
|
-
],
|
|
64
|
-
};
|
|
65
|
-
const filterQueryClause: QueryClause = { selector: ["n", "CSQ", "*", 0], operator: "==", args: [0] };
|
|
66
|
-
const filterQueries: FilterQueries = {
|
|
67
|
-
"CSQ/field1": filterQueryClause,
|
|
68
|
-
};
|
|
69
|
-
expect(createSampleQuery(sample, undefined, filterQueries, meta)).toStrictEqual({
|
|
70
|
-
operator: "and",
|
|
71
|
-
args: [queryClause, filterQueryClause],
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
test("create sample query - undefined search and undefined filters", () => {
|
|
76
|
-
const sample = { data: { index: 1 } } as Item<Sample>;
|
|
77
|
-
const queryClause: Query = {
|
|
78
|
-
operator: "and",
|
|
79
|
-
args: [
|
|
80
|
-
{ selector: ["s", 1, "GT", "t"], operator: "!=", args: "hom_r" },
|
|
81
|
-
{ selector: ["s", 1, "GT", "t"], operator: "!=", args: "miss" },
|
|
82
|
-
],
|
|
83
|
-
};
|
|
84
|
-
expect(createSampleQuery(sample, undefined, undefined, meta)).toStrictEqual(queryClause);
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
test("create query", () => {
|
|
88
|
-
const searchText = "my search text";
|
|
89
|
-
const filterQueries: FilterQueries = {
|
|
90
|
-
"CSQ/field1": { selector: ["n", "CSQ", "*", 0], operator: "==", args: [0] },
|
|
91
|
-
"CSQ/field2": { selector: ["n", "CSQ", "*", 1], operator: "==", args: [1, 2] },
|
|
92
|
-
};
|
|
93
|
-
expect(createQuery(searchText, filterQueries, meta)).toStrictEqual({
|
|
94
|
-
operator: "and",
|
|
95
|
-
args: [
|
|
96
|
-
{
|
|
97
|
-
operator: "or",
|
|
98
|
-
args: [
|
|
99
|
-
{ selector: ["n", "CSQ", "*", "0"], operator: "any_~=_any", args: ["my search text"] },
|
|
100
|
-
{ selector: ["n", "CSQ", "*", "1"], operator: "any_~=_any", args: ["my search text"] },
|
|
101
|
-
],
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
operator: "and",
|
|
105
|
-
args: [
|
|
106
|
-
{ selector: ["n", "CSQ", "*", 0], operator: "==", args: [0] },
|
|
107
|
-
{ selector: ["n", "CSQ", "*", 1], operator: "==", args: [1, 2] },
|
|
108
|
-
],
|
|
109
|
-
},
|
|
110
|
-
],
|
|
111
|
-
});
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
test("create query: undefined search and undefined filters", () => {
|
|
115
|
-
expect(createQuery(undefined, undefined, meta)).toBe(null);
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
test("create query: undefined search and empty filters", () => {
|
|
119
|
-
expect(createQuery(undefined, {}, meta)).toBe(null);
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
test("create query: undefined search and empty filters with keys", () => {
|
|
123
|
-
expect(createQuery(undefined, { filterId: undefined }, meta)).toBe(null);
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
test("create query - search query only", () => {
|
|
127
|
-
const searchText = "searchString";
|
|
128
|
-
expect(createQuery(searchText, undefined, meta)).toStrictEqual({
|
|
129
|
-
args: [
|
|
130
|
-
{
|
|
131
|
-
args: ["searchString"],
|
|
132
|
-
operator: "any_~=_any",
|
|
133
|
-
selector: ["n", "CSQ", "*", "0"],
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
args: ["searchString"],
|
|
137
|
-
operator: "any_~=_any",
|
|
138
|
-
selector: ["n", "CSQ", "*", "1"],
|
|
139
|
-
},
|
|
140
|
-
],
|
|
141
|
-
operator: "or",
|
|
142
|
-
});
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
test("create query - filter queries only", () => {
|
|
146
|
-
const filterQueries = {};
|
|
147
|
-
expect(createQuery(undefined, filterQueries, meta)).toBe(null);
|
|
148
|
-
});
|
|
149
|
-
|
|
150
|
-
test("create query - one filter query", () => {
|
|
151
|
-
const queryClause: QueryClause = { selector: ["n", "CSQ", "*", 0], operator: "==", args: [0] };
|
|
152
|
-
const filterQueries: FilterQueries = {
|
|
153
|
-
"CSQ/field1": queryClause,
|
|
154
|
-
};
|
|
155
|
-
expect(createQuery(undefined, filterQueries, meta)).toBe(queryClause);
|
|
156
|
-
});
|
|
157
|
-
|
|
158
|
-
test("infoSelector", () => {
|
|
159
|
-
expect(infoSelector(fieldMeta1)).toStrictEqual(["n", "CSQ", "field1"]);
|
|
160
|
-
});
|
|
161
|
-
|
|
162
|
-
test("sampleSelector", () => {
|
|
163
|
-
expect(sampleSelector({ id: 1, data: { person: person, index: 0, proband: false } }, fieldMeta1)).toStrictEqual([
|
|
164
|
-
"s",
|
|
165
|
-
0,
|
|
166
|
-
"CSQ",
|
|
167
|
-
"field1",
|
|
168
|
-
]);
|
|
169
|
-
});
|
|
170
|
-
|
|
171
|
-
test("selectorKey", () => {
|
|
172
|
-
expect(selectorKey([1, "test", 2, "3"])).toStrictEqual("1/test/2/3");
|
|
173
|
-
});
|
|
174
|
-
|
|
175
|
-
test("infoFieldKey", () => {
|
|
176
|
-
expect(infoFieldKey(fieldMeta1)).toStrictEqual("n/CSQ/field1");
|
|
177
|
-
});
|
|
178
|
-
|
|
179
|
-
test("sampleFieldKey", () => {
|
|
180
|
-
expect(sampleFieldKey({ id: 1, data: { person: person, index: 0, proband: false } }, fieldMeta1)).toStrictEqual(
|
|
181
|
-
"s/0/CSQ/field1",
|
|
182
|
-
);
|
|
183
|
-
});
|
|
184
|
-
|
|
185
|
-
test("infoSortPath", () => {
|
|
186
|
-
expect(infoSortPath(fieldMetaCsq)).toStrictEqual(["n", "CSQ"]);
|
|
187
|
-
});
|
|
188
|
-
});
|
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test } from "vitest";
|
|
2
|
-
import {
|
|
3
|
-
getSampleAffectedStatusLabel,
|
|
4
|
-
getSampleFamilyMembersWithoutParents,
|
|
5
|
-
getSampleFather,
|
|
6
|
-
getSampleLabel,
|
|
7
|
-
getSampleMother,
|
|
8
|
-
getSampleSexLabel,
|
|
9
|
-
} from "../utils/sample";
|
|
10
|
-
import { Sample } from "@molgenis/vip-report-api/src/Api";
|
|
11
|
-
|
|
12
|
-
describe("sample utilities", () => {
|
|
13
|
-
const sample = {
|
|
14
|
-
person: {
|
|
15
|
-
familyId: "fam0",
|
|
16
|
-
individualId: "0",
|
|
17
|
-
maternalId: "1",
|
|
18
|
-
paternalId: "2",
|
|
19
|
-
},
|
|
20
|
-
} as Sample;
|
|
21
|
-
const motherSample = {
|
|
22
|
-
person: {
|
|
23
|
-
familyId: "fam0",
|
|
24
|
-
individualId: "1",
|
|
25
|
-
},
|
|
26
|
-
} as Sample;
|
|
27
|
-
const fatherSample = {
|
|
28
|
-
person: {
|
|
29
|
-
familyId: "fam0",
|
|
30
|
-
individualId: "2",
|
|
31
|
-
},
|
|
32
|
-
} as Sample;
|
|
33
|
-
const siblingSample = {
|
|
34
|
-
person: {
|
|
35
|
-
familyId: "fam0",
|
|
36
|
-
individualId: "3",
|
|
37
|
-
maternalId: "1",
|
|
38
|
-
paternalId: "2",
|
|
39
|
-
},
|
|
40
|
-
} as Sample;
|
|
41
|
-
const otherMotherSample = {
|
|
42
|
-
person: {
|
|
43
|
-
familyId: "fam1",
|
|
44
|
-
individualId: "1",
|
|
45
|
-
},
|
|
46
|
-
} as Sample;
|
|
47
|
-
const otherFatherSample = {
|
|
48
|
-
person: {
|
|
49
|
-
familyId: "fam1",
|
|
50
|
-
individualId: "2",
|
|
51
|
-
},
|
|
52
|
-
} as Sample;
|
|
53
|
-
const otherSiblingSample = {
|
|
54
|
-
person: {
|
|
55
|
-
familyId: "fam1",
|
|
56
|
-
individualId: "3",
|
|
57
|
-
maternalId: "1",
|
|
58
|
-
paternalId: "2",
|
|
59
|
-
},
|
|
60
|
-
} as Sample;
|
|
61
|
-
|
|
62
|
-
test("getSampleLabel", () => {
|
|
63
|
-
const individualId = "sample_label";
|
|
64
|
-
const sample = {
|
|
65
|
-
person: {
|
|
66
|
-
individualId: individualId,
|
|
67
|
-
},
|
|
68
|
-
} as Sample;
|
|
69
|
-
expect(getSampleLabel(sample)).toBe(individualId);
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
test("getSampleSexLabel:FEMALE", () => {
|
|
73
|
-
const sample = {
|
|
74
|
-
person: {
|
|
75
|
-
sex: "FEMALE",
|
|
76
|
-
},
|
|
77
|
-
} as Sample;
|
|
78
|
-
expect(getSampleSexLabel(sample)).toBe("female");
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
test("getSampleSexLabel:MALE", () => {
|
|
82
|
-
const sample = {
|
|
83
|
-
person: {
|
|
84
|
-
sex: "MALE",
|
|
85
|
-
},
|
|
86
|
-
} as Sample;
|
|
87
|
-
expect(getSampleSexLabel(sample)).toBe("male");
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
test("getSampleSexLabel:OTHER_SEX", () => {
|
|
91
|
-
const sample = {
|
|
92
|
-
person: {
|
|
93
|
-
sex: "OTHER_SEX",
|
|
94
|
-
},
|
|
95
|
-
} as Sample;
|
|
96
|
-
expect(getSampleSexLabel(sample)).toBe("?");
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
test("getSampleSexLabel:UNKNOWN_SEX", () => {
|
|
100
|
-
const sample = {
|
|
101
|
-
person: {
|
|
102
|
-
sex: "UNKNOWN_SEX",
|
|
103
|
-
},
|
|
104
|
-
} as Sample;
|
|
105
|
-
expect(getSampleSexLabel(sample)).toBe("?");
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
test("getSampleAffectedStatusLabel:AFFECTED", () => {
|
|
109
|
-
const sample = {
|
|
110
|
-
person: {
|
|
111
|
-
affectedStatus: "AFFECTED",
|
|
112
|
-
},
|
|
113
|
-
} as Sample;
|
|
114
|
-
expect(getSampleAffectedStatusLabel(sample)).toBe("affected");
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
test("getSampleAffectedStatusLabel:UNAFFECTED", () => {
|
|
118
|
-
const sample = {
|
|
119
|
-
person: {
|
|
120
|
-
affectedStatus: "UNAFFECTED",
|
|
121
|
-
},
|
|
122
|
-
} as Sample;
|
|
123
|
-
expect(getSampleAffectedStatusLabel(sample)).toBe("unaffected");
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
test("getSampleAffectedStatusLabel:MISSING", () => {
|
|
127
|
-
const sample = {
|
|
128
|
-
person: {
|
|
129
|
-
affectedStatus: "MISSING",
|
|
130
|
-
},
|
|
131
|
-
} as Sample;
|
|
132
|
-
expect(getSampleAffectedStatusLabel(sample)).toBe("?");
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
test("getSampleMother", () => {
|
|
136
|
-
expect(
|
|
137
|
-
getSampleMother(sample, [
|
|
138
|
-
sample,
|
|
139
|
-
otherSiblingSample,
|
|
140
|
-
otherFatherSample,
|
|
141
|
-
otherMotherSample,
|
|
142
|
-
siblingSample,
|
|
143
|
-
fatherSample,
|
|
144
|
-
motherSample,
|
|
145
|
-
]),
|
|
146
|
-
).toStrictEqual(motherSample);
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
test("getSampleMother:undefined", () => {
|
|
150
|
-
expect(getSampleMother(sample, [sample, otherSiblingSample, otherFatherSample, otherMotherSample])).toBeUndefined();
|
|
151
|
-
});
|
|
152
|
-
|
|
153
|
-
test("getSampleFather", () => {
|
|
154
|
-
expect(
|
|
155
|
-
getSampleFather(sample, [
|
|
156
|
-
sample,
|
|
157
|
-
otherSiblingSample,
|
|
158
|
-
otherMotherSample,
|
|
159
|
-
otherFatherSample,
|
|
160
|
-
siblingSample,
|
|
161
|
-
motherSample,
|
|
162
|
-
fatherSample,
|
|
163
|
-
]),
|
|
164
|
-
).toStrictEqual(fatherSample);
|
|
165
|
-
});
|
|
166
|
-
|
|
167
|
-
test("getSampleFather:undefined", () => {
|
|
168
|
-
expect(getSampleFather(sample, [sample, otherSiblingSample, otherMotherSample, otherFatherSample])).toBeUndefined();
|
|
169
|
-
});
|
|
170
|
-
|
|
171
|
-
test("getSampleFamilyMembersWithoutParents", () => {
|
|
172
|
-
expect(
|
|
173
|
-
getSampleFamilyMembersWithoutParents(sample, [
|
|
174
|
-
sample,
|
|
175
|
-
otherSiblingSample,
|
|
176
|
-
otherMotherSample,
|
|
177
|
-
otherFatherSample,
|
|
178
|
-
siblingSample,
|
|
179
|
-
motherSample,
|
|
180
|
-
fatherSample,
|
|
181
|
-
]),
|
|
182
|
-
).toStrictEqual([siblingSample]);
|
|
183
|
-
});
|
|
184
|
-
});
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { describe, test } from "vitest";
|
|
2
|
-
import { arrayEquals } from "../utils/utils";
|
|
3
|
-
|
|
4
|
-
describe("utilities", () => {
|
|
5
|
-
test("array equals", () => {
|
|
6
|
-
arrayEquals<string>(["a", "b", "c"], ["a", "b", "c"]);
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
test("array equals: empty array", () => {
|
|
10
|
-
arrayEquals<string>([], []);
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
test("array not equals: order", () => {
|
|
14
|
-
arrayEquals<string>(["a", "b", "c"], ["c", "b", "a"]);
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
test("array not equals: length left", () => {
|
|
18
|
-
arrayEquals<string>(["a", "b", "c"], ["a", "b"]);
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
test("array not equals: length right", () => {
|
|
22
|
-
arrayEquals<string>(["a", "b"], ["a", "b", "c"]);
|
|
23
|
-
});
|
|
24
|
-
});
|