Files
common/packages/util-crypto/src/mnemonic/toEntropy.spec.ts
T
2022-01-01 09:26:11 +02:00

23 lines
705 B
TypeScript

// Copyright 2017-2022 @polkadot/util-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { u8aToHex } from '@polkadot/util';
import tests from '../sr25519/pair/testing.spec';
import { cryptoWaitReady } from '..';
import { mnemonicToEntropy } from './toEntropy';
describe('mnemonicToEntropy', (): void => {
beforeEach(async (): Promise<void> => {
await cryptoWaitReady();
});
describe.each([false, true])('onlyJs=%p', (onlyJs): void => {
tests.forEach(([mnemonic, entropy], index): void => {
it(`Created correct entropy for ${index}`, (): void => {
expect(u8aToHex(mnemonicToEntropy(mnemonic, onlyJs))).toEqual(entropy);
});
});
});
});