Files
notification-elements-demo/node_modules/fast-uri/test/util.test.js
Giuliano Silvestro 5d0c9ec7eb Initial commit: notification-elements-demo app
Interactive Angular 19 demo for @sda/notification-elements-ui with
6 sections: Bell & Feed, Notification Center, Inbox, Comments &
Threads, Mention Input, and Full-Featured layout. Includes mock
data, dark mode toggle, and real-time event log.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 21:49:19 +10:00

39 lines
1.1 KiB
JavaScript

'use strict'
const test = require('tape')
const {
stringArrayToHexStripped,
removeDotSegments
} = require('../lib/utils')
test('stringArrayToHexStripped', (t) => {
const testCases = [
[['0', '0', '0', '0'], ''],
[['0', '0', '0', '1'], '1'],
[['0', '0', '1', '0'], '10'],
[['0', '1', '0', '0'], '100'],
[['1', '0', '0', '0'], '1000'],
[['1', '0', '0', '1'], '1001'],
]
t.plan(testCases.length)
testCases.forEach(([input, expected]) => {
t.same(stringArrayToHexStripped(input), expected)
})
})
// Just fixtures, because this function already tested by resolve
test('removeDotSegments', (t) => {
const testCases = []
// https://github.com/fastify/fast-uri/issues/139
testCases.push(['WS:/WS://1305G130505:1&%0D:1&C(XXXXX*)))))))XXX130505:UUVUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa$aaaaaaaaaaaa13a',
'WS:/WS://1305G130505:1&%0D:1&C(XXXXX*)))))))XXX130505:UUVUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa$aaaaaaaaaaaa13a'])
t.plan(testCases.length)
testCases.forEach(([input, expected]) => {
t.same(removeDotSegments(input), expected)
})
})