aboutsummaryrefslogtreecommitdiff
path: root/docker/netiquette/test/runner.mjs
blob: b4da1de5fc8dc15259b09078e64f695661884d72 (plain) (blame)
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
'use strict'

import io from './io.mjs'
import iptables from './iptables.mjs'

(async () => {
  const res = await [
    ...io,
    ...iptables
  ].map(async f => {
    try { 
      await f()
      return 'passed'
    } 
    catch(e) { 
      console.error(e)
      return 'failed'
    }
  }).reduce(async (acc, r) => {
    const accumulator = await acc
    const result = await r
    accumulator.total++
    accumulator[result]++
    return accumulator
  }, {total: 0, passed: 0, failed: 0})

  console.log(`Done. passed: ${res.passed}, failed: ${res.failed}, total: ${res.total}`)
})()