Files
common/packages/x-textdecoder/src/node.spec.ts
T
Jaco 9c224f5076 Use .js imports in src (#1756)
* Use .js imports in src

* Revert node/test/node -> node/test/node.d.ts (for now)

* util-crypto

* Additional

* Adjust tsconfig aliases

* Bump dev
2023-03-09 11:04:03 +02:00

27 lines
656 B
TypeScript

// Copyright 2017-2023 @polkadot/x-textencoder authors & contributors
// SPDX-License-Identifier: Apache-2.0
/// <reference types="@polkadot/dev/node/test/node" />
import { xglobal } from '@polkadot/x-global';
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
xglobal.TextDecoder = undefined;
describe('TextDecoder (node)', (): void => {
let TD: typeof TextDecoder;
beforeEach(async (): Promise<void> => {
const node = await import('./node.js');
TD = node.TextDecoder;
});
it('encodes correctly', (): void => {
expect(
new TD().decode(new Uint8Array([97, 98, 99]))
).toEqual('abc');
});
});