ghost-portal/packages/ui-api/src/util/isTestChain.spec.js
Jaco Greeff 014ae780e4
Split ui-api, update API version (#589)
* Split ui-api, update API version

* Update (awaiting API changes to go through)

* Cleanup ui-api exports

* Bump API (SubscriptionPromise support)

* Linting fixes

* Update renames

* Do display balances.Transfer (shows for non-owned accounts)

* Bump API
2019-01-12 09:38:07 +01:00

25 lines
1.1 KiB
JavaScript

// Copyright 2017-2019 @polkadot/ui-api 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('check chain spec to configure keyring test mode and dev accounts availability', () => {
it('enables test environment when chain specification matches text of dev or loc(al)', () => {
const validTestModeChainSpecsWithDev = ['Development disorder', 'my development', 'a devotion to'];
const validTestModeChainSpecsWithLoc = ['Local beer', 'one local beer', 'one good locust'];
for (let s of validTestModeChainSpecsWithDev.concat(validTestModeChainSpecsWithLoc)) {
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 = ['PoC-1 Testnet', 'Staging Testnet', 'future PoC-2 Testnet', 'a pocadot?', undefined, 0];
for (let s of invalidTestModeChainSpecs) {
expect(isTestChain(s)).toEqual(false);
}
});
});