HEX
Server: nginx/1.24.0
System: Linux nowruzgan 6.8.0-57-generic #59-Ubuntu SMP PREEMPT_DYNAMIC Sat Mar 15 17:40:59 UTC 2025 x86_64
User: babak (1000)
PHP: 8.3.6
Disabled: NONE
Upload Files
File: /var/dev/shahnamag/back-end/node_modules/fast-uri/test/util.test.js
'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)
  })
})