source: frontend/node_modules/fast-uri/test/util.test.js

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 1.1 KB
Line 
1'use strict'
2
3const test = require('tape')
4const {
5 stringArrayToHexStripped,
6 removeDotSegments
7} = require('../lib/utils')
8
9test('stringArrayToHexStripped', (t) => {
10 const testCases = [
11 [['0', '0', '0', '0'], ''],
12 [['0', '0', '0', '1'], '1'],
13 [['0', '0', '1', '0'], '10'],
14 [['0', '1', '0', '0'], '100'],
15 [['1', '0', '0', '0'], '1000'],
16 [['1', '0', '0', '1'], '1001'],
17 ]
18
19 t.plan(testCases.length)
20
21 testCases.forEach(([input, expected]) => {
22 t.same(stringArrayToHexStripped(input), expected)
23 })
24})
25
26// Just fixtures, because this function already tested by resolve
27test('removeDotSegments', (t) => {
28 const testCases = []
29 // https://github.com/fastify/fast-uri/issues/139
30 testCases.push(['WS:/WS://1305G130505:1&%0D:1&C(XXXXX*)))))))XXX130505:UUVUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa$aaaaaaaaaaaa13a',
31 'WS:/WS://1305G130505:1&%0D:1&C(XXXXX*)))))))XXX130505:UUVUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa$aaaaaaaaaaaa13a'])
32
33 t.plan(testCases.length)
34
35 testCases.forEach(([input, expected]) => {
36 t.same(removeDotSegments(input), expected)
37 })
38})
Note: See TracBrowser for help on using the repository browser.