summaryrefslogtreecommitdiffstats
path: root/services/sync/tests/tps/test_addresses.js
blob: d9b42f6236a196a82064fe5b2a8e57ee6942dd79 (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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/* Any copyright is dedicated to the Public Domain.
   http://creativecommons.org/publicdomain/zero/1.0/ */

/* global Services */
Services.prefs.setBoolPref("services.sync.engine.addresses", true);

EnableEngines(["addresses"]);

var phases = {
  phase1: "profile1",
  phase2: "profile2",
  phase3: "profile1",
};

const address1 = [
  {
    "given-name": "Timothy",
    "additional-name": "John",
    "family-name": "Berners-Lee",
    organization: "World Wide Web Consortium",
    "street-address": "32 Vassar Street\nMIT Room 32-G524",
    "address-level2": "Cambridge",
    "address-level1": "MA",
    "postal-code": "02139",
    country: "US",
    tel: "+16172535702",
    email: "timbl@w3.org",
    changes: {
      organization: "W3C",
    },
  },
];

const address1_after = [
  {
    "given-name": "Timothy",
    "additional-name": "John",
    "family-name": "Berners-Lee",
    organization: "W3C",
    "street-address": "32 Vassar Street\nMIT Room 32-G524",
    "address-level2": "Cambridge",
    "address-level1": "MA",
    "postal-code": "02139",
    country: "US",
    tel: "+16172535702",
    email: "timbl@w3.org",
  },
];

const address2 = [
  {
    "given-name": "John",
    "additional-name": "R.",
    "family-name": "Smith",
    organization: "Mozilla",
    "street-address":
      "Geb\u00E4ude 3, 4. Obergeschoss\nSchlesische Stra\u00DFe 27",
    "address-level2": "Berlin",
    "address-level1": "BE",
    "postal-code": "10997",
    country: "DE",
    tel: "+4930983333000",
    email: "timbl@w3.org",
  },
];

Phase("phase1", [[Addresses.add, address1], [Sync]]);

Phase("phase2", [
  [Sync],
  [Addresses.verify, address1],
  [Addresses.modify, address1],
  [Addresses.add, address2],
  [Sync],
]);

Phase("phase3", [
  [Sync],
  [Addresses.verify, address1_after],
  [Addresses.verify, address2],
  [Sync],
]);