* Move test cryptoWaitReady top-level * Add missing mod.ts * Revert mod.ts add * Add types reference for tests * Adjust * adjust * node:fs & node:path
29 lines
914 B
TypeScript
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);
|
|
});
|
|
});
|
|
}
|
|
});
|