Files
common/packages/util/src/u8a/fromString.spec.js
T
Jaco Greeff 461dde7c3c Copyright project authors (#137)
* Copyright project authors

* Add contributors
2018-06-13 22:24:48 +02:00

21 lines
667 B
JavaScript

// Copyright 2017-2018 @polkadot/util authors & contributors
// This software may be modified and distributed under the terms
// of the ISC license. See the LICENSE file for details.
const { u8aFromString } = require('./index');
describe('u8aFromString', () => {
it('encodes a string byte for byte', () => {
expect(
u8aFromString('12345678901234567890123456789012')
).toEqual(
new Uint8Array([
0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38,
0x39, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36,
0x37, 0x38, 0x39, 0x30, 0x31, 0x32, 0x33, 0x34,
0x35, 0x36, 0x37, 0x38, 0x39, 0x30, 0x31, 0x32
])
);
});
});