• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mozilla / blurts-server / #11967

pending completion
#11967

push

circleci

web-flow
MNTOR-1038 refactor email utility for V2 (#2772)

* refactor email utility MNTOR-1038
* add testdouble mocking library per ADR 0000

282 of 1202 branches covered (23.46%)

Branch coverage included in aggregate %.

58 of 58 new or added lines in 3 files covered. (100.0%)

959 of 3205 relevant lines covered (29.92%)

2.43 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/db/seeds/test_subscribers.js
1
/* This Source Code Form is subject to the terms of the Mozilla Public
2
 * License, v. 2.0. If a copy of the MPL was not distributed with this
3
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4

5
'use strict'
6

7
import { getSha1 } from '../../utils/fxa.js'
8

9
export const TEST_SUBSCRIBERS = {
×
10
  firefox_account: {
11
    id: 12345,
12
    primary_sha1: getSha1('firefoxaccount@test.com'),
13
    primary_email: 'firefoxaccount@test.com',
14
    primary_verification_token: '0e2cb147-2041-4e5b-8ca9-494e773b2cf1',
15
    primary_verified: true,
16
    fxa_access_token: '4a4792b89434153f1a6262fbd6a4510c00834ff842585fc4f4d972da158f0fc0',
17
    fxa_refresh_token: '4a4792b89434153f1a6262fbd6a4510c00834ff842585fc4f4d972da158f0fc1',
18
    fxa_uid: 12345,
19
    fxa_profile_json: {},
20
    breaches_last_shown: '2019-04-24 13:27:08.421-05',
21
    breaches_resolved: { 'firefoxaccount@test.com': [0] }
22
  },
23
  all_emails_to_primary: {
24
    id: 67890,
25
    primary_sha1: getSha1('all_emails_to_primary@test.com'),
26
    primary_email: 'all_emails_to_primary@test.com',
27
    primary_verification_token: '0e2cb147-2041-4e5b-8ca9-494e773b2ca7',
28
    primary_verified: true,
29
    fxa_refresh_token: '4a4792b89434153f1a6262fbd6a4510c00834ff842585fc4f4d972da158f0fc2',
30
    breaches_last_shown: '2019-04-24 13:27:08.421-05',
31
    all_emails_to_primary: true
32
  },
33
  unverified_email: {
34
    primary_sha1: getSha1('unverifiedemail@test.com'),
35
    primary_email: 'unverifiedemail@test.com',
36
    primary_verification_token: '0e2cb147-2041-4e5b-8ca9-494e773b2cf0',
37
    primary_verified: false
38
  },
39
  verified_email: {
40
    primary_sha1: getSha1('verifiedemail@test.com'),
41
    primary_email: 'verifiedemail@test.com',
42
    primary_verification_token: '54010800-6c3c-4186-971a-76dc92874941',
43
    primary_verified: true,
44
    signup_language: 'en-US;q=0.7,en;q=0.3'
45
  },
46
  has_breaches: {
47
    id: 12346,
48
    created_at: '2022-06-07 14:29:00.000-05',
49
    primary_sha1: getSha1('has-breaches@example.com'),
50
    primary_email: 'has-breaches@example.com',
51
    primary_verification_token: 'c165711a-69d1-42f1-9850-ce74754f36de',
52
    primary_verified: true,
53
    fxa_access_token: '5a4792b89434153f1a6262fbd6a4510c00834ff842585fc4f4d972da158f0fc0',
54
    fxa_refresh_token: '5a4792b89434153f1a6262fbd6a4510c00834ff842585fc4f4d972da158f0fc1',
55
    fxa_uid: 12346,
56
    fxa_profile_json: {},
57
    breaches_last_shown: '2022-07-08 14:19:00.000-05',
58
    breaches_resolved: { 'has-breaches@example.com': [1] },
59
    breach_stats: {
60
      passwords: {
61
        count: 1,
62
        numResolved: 0
63
      },
64
      numBreaches: {
65
        count: 2,
66
        numResolved: 1,
67
        numUnresolved: 1
68
      },
69
      monitoredEmails: {
70
        count: 1
71
      }
72
    },
73
    monthly_email_at: '2022-08-07 14:22:00.000-05',
74
    monthly_email_optout: false,
75
    signup_language: 'fr-CH, fr;q=0.9, en;q=0.8, de;q=0.7,*;q=0.5'
76
  }
77
}
78

79
export const TEST_EMAIL_ADDRESSES = {
×
80
  firefox_account: {
81
    id: 11111,
82
    subscriber_id: 12345,
83
    sha1: getSha1('firefoxaccount-secondary@test.com'),
84
    email: 'firefoxaccount-secondary@test.com',
85
    verification_token: '0e2cb147-2041-4e5b-8ca9-494e773b2cf2',
86
    verified: true
87
  },
88
  unverified_email_on_firefox_account: {
89
    id: 98765,
90
    subscriber_id: 12345,
91
    sha1: getSha1('firefoxaccount-tertiary@test.com'),
92
    email: 'firefoxaccount-tertiary@test.com',
93
    verification_token: '0e2cb147-2041-4e5b-8ca9-494e773b2cf3',
94
    verified: false
95
  },
96
  all_emails_to_primary: {
97
    id: 99999,
98
    subscriber_id: 67890,
99
    sha1: getSha1('secondary_sending_to_primary@test.com'),
100
    email: 'secondary_sending_to_primary@test.com',
101
    verification_token: '0e2cb147-2041-4e5b-8ca9-494e773b2cf4',
102
    verified: true
103
  },
104
  has_breaches: {
105
    id: 11112,
106
    subscriber_id: 12346,
107
    sha1: getSha1('has-breaches@example.com'),
108
    email: 'has-breaches@example.com',
109
    verification_token: 'c165711a-69d1-42f1-9850-ce74754f36df',
110
    verified: true
111
  }
112
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc