2021-12-16 09:02:22 -06:00
|
|
|
// Copyright 2021 Signal Messenger, LLC
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
|
|
|
import { assert } from 'chai';
|
|
|
|
|
2025-09-16 17:39:03 -07:00
|
|
|
import { normalizeDeviceName } from '../../util/normalizeDeviceName.js';
|
2021-12-16 09:02:22 -06:00
|
|
|
|
|
|
|
describe('normalizeDeviceName', () => {
|
|
|
|
it('leaves normal device names untouched', () => {
|
|
|
|
for (const name of ['foo', 'bar Baz', '💅💅💅']) {
|
|
|
|
assert.strictEqual(normalizeDeviceName(name), name);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
it('trims device names', () => {
|
|
|
|
assert.strictEqual(normalizeDeviceName(' foo\t'), 'foo');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('removes null characters', () => {
|
|
|
|
assert.strictEqual(normalizeDeviceName('\0foo\0bar'), 'foobar');
|
|
|
|
});
|
|
|
|
});
|