Files
common/packages/util/src/u8a/toBuffer.spec.ts
T
2021-01-03 11:20:22 +01:00

19 lines
483 B
TypeScript

// Copyright 2017-2021 @polkadot/util authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { u8aToBuffer } from '.';
describe('u8aToBuffer', (): void => {
it('returns [] when the buffer is null', (): void => {
expect(
u8aToBuffer(null)
).toEqual(Buffer.from([]));
});
it('returns the Buffer value for the Uint8Array', (): void => {
expect(
u8aToBuffer(new Uint8Array([128, 0, 10]))
).toEqual(Buffer.from([128, 0, 10]));
});
});