Skip to content

Commit

Permalink
fix: remove cold from flu patterns (#1193)
Browse files Browse the repository at this point in the history
  • Loading branch information
cfabianski authored Aug 17, 2023
1 parent a21804b commit 653d64c
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"exclude_types": ["boolean"],
"friendly_name": "Flu",
"health_context_data_type_uuid": null,
"include_regexp": "\\b(flu|influenza|cold)\\b",
"include_regexp": "\\b(flu|influenza)\\b",
"match_column": true,
"match_object": false,
"object_type": ["known", "unknown_extended"]
Expand Down
1 change: 0 additions & 1 deletion pkg/classification/schema/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,6 @@ func (classifier *Classifier) classifyKnownObject(
}

classifiedDatatype.Properties[i] = classifyAsInvalid(detection.Properties[i], "invalid_property", subjectName)

}

if validProperties {
Expand Down
44 changes: 44 additions & 0 deletions pkg/classification/schema/schema_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -904,6 +904,7 @@ func TestSchemaObjectClassification(t *testing.T) {
},
},
}

classifier := schema.New(
schema.Config{
DataTypes: db.Default().DataTypes,
Expand All @@ -919,4 +920,47 @@ func TestSchemaObjectClassification(t *testing.T) {
assert.Equal(t, testCase.Want, output.Classification)
})
}

t.Run("incorrect Personal health history classification", func(t *testing.T) {
output := classifier.Classify(
schema.ClassificationRequest{
Filename: "src/components/order/client-transaction-modals/withdraw-vault/index.jsx",
DetectorType: detectors.DetectorJavascript,
Value: &schema.ClassificationRequestDetection{
Name: "selfManagedCustodySigningSteps",
SimpleType: reportschema.SimpleTypeObject,
Properties: []*schema.ClassificationRequestDetection{
{
Name: "cold",
SimpleType: reportschema.SimpleTypeString,
},
},
},
})

assert.Equal(t, &schema.ClassifiedDatatype{
Name: "selfManagedCustodySigningSteps",
Properties: []*schema.ClassifiedDatatype{
{
Name: "cold",
Properties: nil,
Classification: schema.Classification{
Name: "cold",
DataType: nil,
Decision: classify.ClassificationDecision{
State: classify.Invalid,
Reason: "invalid_property",
},
},
},
},
Classification: schema.Classification{
Name: "self managed custody signing steps",
Decision: classify.ClassificationDecision{
State: classify.Invalid,
Reason: "valid_object_with_invalid_properties",
},
},
}, output)
})
}

0 comments on commit 653d64c

Please sign in to comment.