* fix: Detect chain specs that enable test environment and dev accounts Issue #130
* test: refactor moving chain checker into meaningful function name
* fix: Detect check specs requiring backward compatibility encoding for Issue #130
* remove comment
* remove comment and restore source maps
* fix: Fix the license information in test files
* refactor: Move cases into array with meaningful array. Cater for numbers
* refactor: Reduce how condensed the code is
* refactor: Use Polkadot isUndefined helper
* refactor: Move RegEx instantiation outside function so not called every time
* refactor: Move new utility functions and associated tests into ui-react-rx/src/util
* fix: Update to cater for renaming of poc-2 to staging
See commit updates since `poc-2` has been renamed to `staging` 3426552c76
26 lines
1.1 KiB
JavaScript
26 lines
1.1 KiB
JavaScript
// Copyright 2017-2018 @polkadot/ui-react-rx authors & contributors
|
|
// This software may be modified and distributed under the terms
|
|
// of the ISC license. See the LICENSE file for details.
|
|
|
|
import shouldUseLatestChain from './shouldUseLatestChain';
|
|
|
|
describe('check chain spec to configure encoding', () => {
|
|
it('enables PoC-1 encoding when chain specification is PoC-1 or undefined', () => {
|
|
let validChainSpecWithPoC1 = ['try poc-1 now', 'testing PoC-1 Testnet'];
|
|
const validChainSpecWithUndefinedOrNumber = [undefined];
|
|
|
|
for (let s of validChainSpecWithPoC1.concat(validChainSpecWithUndefinedOrNumber)) {
|
|
expect(shouldUseLatestChain(s)).toEqual(false);
|
|
}
|
|
});
|
|
|
|
it('enables Latest encoding when chain specification is NOT PoC-1 or undefined', () => {
|
|
const invalidChainSpecWithoutPoC1OrUndefined = ['poc-2', 'PoC-2 Testnet', 'staging',
|
|
'Staging Testnet', 'Local', 'Development', ' development', 'dev', 'Local', ' local ', 'loc', 0];
|
|
|
|
for (let s of invalidChainSpecWithoutPoC1OrUndefined) {
|
|
expect(shouldUseLatestChain(s)).toEqual(true);
|
|
}
|
|
});
|
|
});
|