Skip to content

Commit

Permalink
Fixed test and rego that were backwards
Browse files Browse the repository at this point in the history
  • Loading branch information
salgattcy committed Nov 16, 2023
1 parent 29b8829 commit 0e23ace
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 28 deletions.
Original file line number Diff line number Diff line change
@@ -1,25 +1,13 @@
package classifier_cardholder_name

test_dob_pattern {
output.cardholder_name == "CARDHOLDER_NAME" with input as {"cardholder_name":"John Doe"}
output := {k: v |
v := classify(k, input[k])
}

test_dob_pattern {
output.cardholder_name == "CARDHOLDER_NAME" with input as {"cardholder_name":"Robert Williams-Brown"}
}

test_dob_pattern {
output.cardholdername == "CARDHOLDER_NAME" with input as {"cardholdername":"Robert Williams-Brown"}
}

test_dob_pattern {
output.cardholderName == "CARDHOLDER_NAME" with input as {"cardholderName":"Robert Williams-Brown"}
}

test_dob_pattern {
output.cardholder_Name == "CARDHOLDER_NAME" with input as {"cardholder_Name":"Robert Williams-Brown"}
}

test_dob_pattern {
output.cardholderName == "CARDHOLDER_NAME" with input as {"cardholderName":"Robert Williams-Brown"}
classify(key, val) := "CARDHOLDER_NAME" {
contains(lower(key), "cardholder")
contains(lower(key), "name")
regex.match(`^([A-Za-z '-]+[\sA-Za-z '-]+)$`, val)
} else = "UNLABELED" {
true
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,25 @@
package classifier_cardholder_name

output := {k: v |
v := classify(k, input[k])
test_dob_pattern {
output.cardholder_name == "CARDHOLDER_NAME" with input as {"cardholder_name":"John Doe"}
}

classify(key, val) := "CARDHOLDER_NAME" {
contains(lower(key), "cardholder")
contains(lower(key), "name")
regex.match(`^([A-Za-z '-]+[\sA-Za-z '-]+)$`, val)
} else = "UNLABELED" {
true
test_dob_pattern {
output.cardholder_name == "CARDHOLDER_NAME" with input as {"cardholder_name":"Robert Williams-Brown"}
}

test_dob_pattern {
output.cardholdername == "CARDHOLDER_NAME" with input as {"cardholdername":"Robert Williams-Brown"}
}

test_dob_pattern {
output.cardholderName == "CARDHOLDER_NAME" with input as {"cardholderName":"Robert Williams-Brown"}
}

test_dob_pattern {
output.cardholder_Name == "CARDHOLDER_NAME" with input as {"cardholder_Name":"Robert Williams-Brown"}
}

test_dob_pattern {
output.cardholderName == "CARDHOLDER_NAME" with input as {"cardholderName":"Robert Williams-Brown"}
}

0 comments on commit 0e23ace

Please sign in to comment.