Files
pezkuwi-ui/packages/ui-util/src/isTestChain.spec.ts
T
Jaco Greeff 9ce16e99bc Add ui-util formatting & util (#76)
* Add ui-util formatting & util

* Update README
2019-02-18 11:02:42 +01:00

25 lines
1012 B
TypeScript

// Copyright 2017-2019 @polkadot/ui-util authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import isTestChain from './isTestChain';
describe('isTestChain', () => {
it('enables test environment when chain specification matches text of dev or loc(al)', () => {
const validTestModeChainSpecsWithDev = ['Development'];
const validTestModeChainSpecsWithLoc = ['Local Testnet'];
validTestModeChainSpecsWithDev.concat(validTestModeChainSpecsWithLoc).forEach((s) =>
expect(isTestChain(s)).toEqual(true)
);
});
it('disables keyring test mode when chain specification is not a test mode or undefined or number type', () => {
const invalidTestModeChainSpecs = ['dev', 'local', 'development', 'PoC-1 Testnet', 'Staging Testnet', 'future PoC-2 Testnet', 'a pocadot?', undefined];
invalidTestModeChainSpecs.forEach((s) =>
expect(isTestChain(s)).toEqual(false)
);
});
});