啊鑫
8 天以前 fca192d3c38c5dcfbb6ace8bc71d6078f6a079b2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
'use strict'
 
const test = require('tape')
const {
  stringArrayToHexStripped
} = require('../lib/utils')
 
test('stringArrayToHexStripped', (t) => {
  const testCases = [
    [[['0', '0', '0', '0']], ''],
    [[['0', '0', '0', '0'], false], ''],
    [[['0', '0', '0', '0'], true], '0'],
    [[['0', '1', '0', '0'], false], '100'],
    [[['1', '0', '0', '0'], false], '1000'],
    [[['1', '0', '0', '0'], true], '1000']
  ]
 
  t.plan(testCases.length)
 
  testCases.forEach(([input, expected]) => {
    t.same(stringArrayToHexStripped(input[0], input[1]), expected)
  })
})