summaryrefslogtreecommitdiffstats
path: root/browser/extensions/formautofill/test/unit/test_addressComponent_city.js
blob: 8bb448cfe4ebedc3230cee9512788ca68667237c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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 };
  });
});