Files
common/packages/x-textdecoder/src/fallback.spec.ts
T
2022-01-01 09:26:11 +02:00

19 lines
531 B
TypeScript

// Copyright 2017-2022 @polkadot/x-textencoder authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { TextDecoder } from './fallback';
describe('TextDecoder (fallback)', (): void => {
it('decodes correctly', (): void => {
expect(
new TextDecoder().decode(new Uint8Array([97, 98, 99]))
).toEqual('abc');
});
it('decodes correctly (with constructor param)', (): void => {
expect(
new TextDecoder('utf-8').decode(new Uint8Array([97, 98, 99, 98, 97]))
).toEqual('abcba');
});
});