summaryrefslogtreecommitdiffstats
path: root/browser/components/newtab/test/unit/asrouter/constants.js
blob: 392ca66ae3c34d495fe2184e5b95cd99e77bfe6e (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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
export const CHILD_TO_PARENT_MESSAGE_NAME = "ASRouter:child-to-parent";
export const PARENT_TO_CHILD_MESSAGE_NAME = "ASRouter:parent-to-child";

export const FAKE_LOCAL_MESSAGES = [
  {
    id: "foo",
    provider: "snippets",
    template: "simple_snippet",
    content: { title: "Foo", body: "Foo123" },
  },
  {
    id: "foo1",
    template: "simple_snippet",
    provider: "snippets",
    bundled: 2,
    order: 1,
    content: { title: "Foo1", body: "Foo123-1" },
  },
  {
    id: "foo2",
    template: "simple_snippet",
    provider: "snippets",
    bundled: 2,
    order: 2,
    content: { title: "Foo2", body: "Foo123-2" },
  },
  {
    id: "bar",
    template: "fancy_template",
    content: { title: "Foo", body: "Foo123" },
  },
  { id: "baz", content: { title: "Foo", body: "Foo123" } },
  {
    id: "newsletter",
    provider: "snippets",
    template: "newsletter_snippet",
    content: { title: "Foo", body: "Foo123" },
  },
  {
    id: "fxa",
    provider: "snippets",
    template: "fxa_signup_snippet",
    content: { title: "Foo", body: "Foo123" },
  },
  {
    id: "belowsearch",
    provider: "snippets",
    template: "simple_below_search_snippet",
    content: { text: "Foo" },
  },
];
export const FAKE_LOCAL_PROVIDER = {
  id: "onboarding",
  type: "local",
  localProvider: "FAKE_LOCAL_PROVIDER",
  enabled: true,
  cohort: 0,
};
export const FAKE_LOCAL_PROVIDERS = {
  FAKE_LOCAL_PROVIDER: {
    getMessages: () => Promise.resolve(FAKE_LOCAL_MESSAGES),
  },
};

export const FAKE_REMOTE_MESSAGES = [
  {
    id: "qux",
    template: "simple_snippet",
    content: { title: "Qux", body: "hello world" },
  },
];
export const FAKE_REMOTE_PROVIDER = {
  id: "remotey",
  type: "remote",
  url: "http://fake.com/endpoint",
  enabled: true,
};

export const FAKE_REMOTE_SETTINGS_PROVIDER = {
  id: "remotey-settingsy",
  type: "remote-settings",
  collection: "collectionname",
  enabled: true,
};

const notificationText = new String("Fake notification text"); // eslint-disable-line
notificationText.attributes = { tooltiptext: "Fake tooltip text" };

export const FAKE_RECOMMENDATION = {
  id: "fake_id",
  template: "cfr_doorhanger",
  content: {
    category: "cfrDummy",
    bucket_id: "fake_bucket_id",
    notification_text: notificationText,
    info_icon: {
      label: "Fake Info Icon Label",
      sumo_path: "a_help_path_fragment",
    },
    heading_text: "Fake Heading Text",
    icon_class: "Fake Icon class",
    addon: {
      title: "Fake Addon Title",
      author: "Fake Addon Author",
      icon: "a_path_to_some_icon",
      rating: "4.2",
      users: "1234",
      amo_url: "a_path_to_amo",
    },
    descriptionDetails: {
      steps: [{ string_id: "cfr-features-step1" }],
    },
    text: "Here is the recommendation text body",
    buttons: {
      primary: {
        label: { string_id: "primary_button_id" },
        action: {
          id: "primary_action",
          data: {},
        },
      },
      secondary: [
        {
          label: { string_id: "secondary_button_id" },
          action: { id: "secondary_action" },
        },
        {
          label: { string_id: "secondary_button_id_2" },
        },
        {
          label: { string_id: "secondary_button_id_3" },
          action: { id: "secondary_action" },
        },
      ],
    },
  },
};