tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_creditcards.js (1225B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 /* global Services */
      5 Services.prefs.setBoolPref("services.sync.engine.creditcards", true);
      6 
      7 EnableEngines(["creditcards"]);
      8 
      9 var phases = {
     10  phase1: "profile1",
     11  phase2: "profile2",
     12  phase3: "profile1",
     13 };
     14 
     15 const cc1 = [
     16  {
     17    "cc-name": "John Doe",
     18    "cc-number": "4716179744040592",
     19    "cc-exp-month": 4,
     20    "cc-exp-year": 2050,
     21    "unknown-1": "an unknown field from another client",
     22    changes: {
     23      "cc-exp-year": 2051,
     24    },
     25  },
     26 ];
     27 
     28 const cc1_after = [
     29  {
     30    "cc-name": "John Doe",
     31    "cc-number": "4716179744040592",
     32    "cc-exp-month": 4,
     33    "cc-exp-year": 2051,
     34    "unknown-1": "an unknown field from another client",
     35  },
     36 ];
     37 
     38 const cc2 = [
     39  {
     40    "cc-name": "Timothy Berners-Lee",
     41    "cc-number": "2221000374457678",
     42    "cc-exp-month": 12,
     43    "cc-exp-year": 2050,
     44  },
     45 ];
     46 
     47 Phase("phase1", [[CreditCards.add, cc1], [Sync]]);
     48 
     49 Phase("phase2", [
     50  [Sync],
     51  [CreditCards.verify, cc1],
     52  [CreditCards.modify, cc1],
     53  [CreditCards.add, cc2],
     54  [Sync],
     55 ]);
     56 
     57 Phase("phase3", [
     58  [Sync],
     59  [CreditCards.verifyNot, cc1],
     60  [CreditCards.verify, cc1_after],
     61  [CreditCards.verify, cc2],
     62 ]);