Files
common/packages/util-crypto/src/mnemonic/validate.spec.ts
T
Jaco 3e2c3a6ed8 Move test cryptoWaitReady top-level (#1747)
* Move test cryptoWaitReady top-level

* Add missing mod.ts

* Revert mod.ts add

* Add types reference for tests

* Adjust

* adjust

* node:fs & node:path
2023-02-25 11:13:51 +02:00

29 lines
914 B
TypeScript

// Copyright 2017-2023 @polkadot/util-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
// eslint-disable-next-line spaced-comment
/// <reference types="@polkadot/dev/node/test/node" />
import { cryptoWaitReady } from '..';
import { mnemonicValidate } from './validate';
await cryptoWaitReady();
describe('mnemonicValidate', (): void => {
for (const onlyJs of [undefined, true]) {
describe(`onlyJs=${(onlyJs && 'true') || 'false'}`, (): void => {
it('returns true on valid', (): void => {
expect(
mnemonicValidate('seed sock milk update focus rotate barely fade car face mechanic mercy', onlyJs)
).toEqual(true);
});
it('returns false on invalid', (): void => {
expect(
mnemonicValidate('wine photo extra cushion basket dwarf humor cloud truck job boat submit', onlyJs)
).toEqual(false);
});
});
}
});