summaryrefslogtreecommitdiffstats
path: root/browser/extensions/formautofill/test/unit/test_addressComponent_city.js
diff options
context:
space:
mode:
Diffstat (limited to 'browser/extensions/formautofill/test/unit/test_addressComponent_city.js')
-rw-r--r--browser/extensions/formautofill/test/unit/test_addressComponent_city.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/browser/extensions/formautofill/test/unit/test_addressComponent_city.js b/browser/extensions/formautofill/test/unit/test_addressComponent_city.js
new file mode 100644
index 0000000000..8bb448cfe4
--- /dev/null
+++ b/browser/extensions/formautofill/test/unit/test_addressComponent_city.js
@@ -0,0 +1,27 @@
+"use strict";
+
+const VALID_TESTS = [["New York City", true]];
+
+const COMPARE_TESTS = [
+ ["New York City", "New York City", SAME],
+ ["New York City", "new york city", SAME],
+ ["New York City", "New York City", SIMILAR], // Merge whitespace
+ ["Happy Valley-Goose Bay", "Happy Valley Goose Bay", SIMILAR], // Replace punctuation with whitespace
+ ["New York City", "New York", A_CONTAINS_B],
+ ["New York", "NewYork", DIFFERENT],
+ ["New York City", "City New York", DIFFERENT],
+];
+
+const TEST_FIELD_NAME = "City";
+
+add_task(async function test_isValid() {
+ runIsValidTest(VALID_TESTS, TEST_FIELD_NAME, value => {
+ return { "address-level2": value };
+ });
+});
+
+add_task(async function test_compare() {
+ runCompareTest(COMPARE_TESTS, TEST_FIELD_NAME, value => {
+ return { "address-level2": value };
+ });
+});