Skip to content

Commit

Permalink
add unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
lonegunmanb committed Feb 20, 2025
1 parent 77ac6fe commit 9f01a6c
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions policy/common/common.utils_test.rego
Original file line number Diff line number Diff line change
Expand Up @@ -239,4 +239,22 @@ test_is_azure_type if {

# Test case: resource type does not match any Azure type
not utils.is_azure_type({"type": "Custom.ResourceType@2024-12-01-preview"}, "Microsoft.DocumentDB/databaseAccounts")
}

test_get_change_after_unknown if {
# Test case: after_unknown is true
input_with_after_unknown := {
"change": {
"after_unknown": 123
}
}
result_with_after_unknown := utils._get_change_after_unknown(input_with_after_unknown)
result_with_after_unknown == 123

# Test case: after_unknown is not present
input_without_after_unknown := {
"change": {}
}
result_without_after_unknown := utils._get_change_after_unknown(input_without_after_unknown)
result_without_after_unknown == []
}

0 comments on commit 9f01a6c

Please sign in to comment.