Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

test: more cosmosdb masking test case (#15262)

h3n4l8bea6f243e13
diff --git a/backend/api/v1/catalog_masking_test.go b/backend/api/v1/catalog_masking_test.go
index eb1504f347..63b62c25bd 100644
--- a/backend/api/v1/catalog_masking_test.go
+++ b/backend/api/v1/catalog_masking_test.go
@@ -20,6 +20,32 @@ func TestWalkAndMaskJSON(t *testing.T) {
}
testCases := []testCase{
+ {
+ description: "empty object",
+ input: `{}`,
+ objectSchema: &storepb.ObjectSchema{
+ Type: storepb.ObjectSchema_OBJECT,
+ Kind: &storepb.ObjectSchema_StructKind_{
+ StructKind: &storepb.ObjectSchema_StructKind{
+ Properties: map[string]*storepb.ObjectSchema{
+ "ssn": {
+ SemanticType: "PII-SSN",
+ Type: storepb.ObjectSchema_STRING,
+ },
+ },
+ },
+ },
+ },
+ semanticTypeToMasker: map[string]masker.Masker{},
+ want: `{}`,
+ },
+ {
+ description: "no semantic type",
+ input: `{"name": "John"}`,
+ objectSchema: &storepb.ObjectSchema{},
+ semanticTypeToMasker: map[string]masker.Masker{},
+ want: `{"name": "John"}`,
+ },
{
description: "mask the outest semantic type",
input: `{"name": "John", "ssn": "123-45-6789"}`,