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

mozilla / blurts-server / #11633

pending completion
#11633

push

circleci

web-flow
Merge pull request #2730 from mozilla/MNTOR-1058/breaches-formatted-copy

Mntor 1058/breaches formatted copy

278 of 1068 branches covered (26.03%)

Branch coverage included in aggregate %.

7 of 7 new or added lines in 1 file covered. (100.0%)

948 of 2891 relevant lines covered (32.79%)

2.63 hits per line

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

0.0
/src/views/partials/breaches.js
1
import { getMessage, getLocale } from '../../utils/fluent.js'
2

3
const rowHtml = data => `
×
4
<details>
5
  <summary>
6
    <span>${data.companyName}</span><span>${data.dataClasses}</span><span>${data.breachDate}</span>
7
  </summary>
8
  <div>
9
    ${data.description}
10
  </div>
11
</details>
12
`
13

14
function createRows (data) {
15
  const locale = getLocale()
×
16
  const allEmailBreaches = data.verifiedEmails.flatMap(item => item.breaches)
×
17
  let breachDate, addedDate, dataClassesTranslated
18

19
  const formattedBreaches = allEmailBreaches.map(breach => {
×
20
    breachDate = Date.parse(breach.BreachDate)
×
21
    addedDate = Date.parse(breach.AddedDate)
×
22
    dataClassesTranslated = breach.DataClasses.map(item => getMessage(item))
×
23

24
    return {
×
25
      companyName: breach.Title,
26
      breachDate: new Intl.DateTimeFormat(locale, { year: 'numeric', month: '2-digit', day: '2-digit', timeZone: 'UTC' }).format(breachDate),
27
      dataClasses: new Intl.ListFormat(locale, { style: 'narrow' }).format(dataClassesTranslated),
28
      description: getMessage('breach-description', {
29
        companyName: breach.Title,
30
        breachDate: new Intl.DateTimeFormat(locale, { dateStyle: 'long', timeZone: 'UTC' }).format(breachDate),
31
        addedDate: new Intl.DateTimeFormat(locale, { dateStyle: 'long', timeZone: 'UTC' }).format(addedDate),
32
        dataClasses: new Intl.ListFormat(locale, { style: 'long' }).format(dataClassesTranslated)
33
      })
34
    }
35
  })
36

37
  return formattedBreaches.map(breach => rowHtml(breach)).join('')
×
38
}
39

40
export const breaches = data => `
×
41
<section class='breach-rows'>
42
  <header>
43
    <span>${getMessage('column-company')}</span><span>${getMessage('column-breached-data')}</span><span>${getMessage('column-detected')}</span>
44
  </header>
45
  ${createRows(data.breachesData)}
46
</section>
47
<section style='display:none'>
48
  <button id="update-breaches">Update Breaches</button>
49
  <pre>${JSON.stringify(data.breachesData, null, 2)}</pre>
50
</section>
51
`
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