-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
39 lines (22 loc) · 838 Bytes
/
test.js
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
'use strict'
import gCertCheck from './index.js'
(async () => {
console.log('Run all concurrently but fail all if any error')
const sites1 = ['garyscott.net', 'omnomnm.com']
const promises1 = sites1.map(url => gCertCheck(url))
await Promise.all(promises1)
.then(result => console.table(result))
.catch(error => console.table(error))
console.log('Run all concurrently showing both success and failure')
const sites2 = ['garyscott.net', 'does-not-exist.garyscott.net']
const promises2 = sites2.map(url => gCertCheck(url))
await Promise.allSettled(promises2)
.then((results) => results.forEach((result) => console.table(result)))
console.log('Run one')
try {
const result = await gCertCheck('garyscott.net')
console.table(result)
} catch (error) {
console.table(error)
}
})()