summaryrefslogtreecommitdiffstats
path: root/browser/extensions/formautofill/test/unit/test_addressComponent_city.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
commit6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch)
treea68f146d7fa01f0134297619fbe7e33db084e0aa /browser/extensions/formautofill/test/unit/test_addressComponent_city.js
parentInitial commit. (diff)
downloadthunderbird-upstream.tar.xz
thunderbird-upstream.zip
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
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 };
+ });
+});