mirror of
https://github.com/status-im/MyCrypto.git
synced 2025-01-15 21:54:54 +00:00
c0cd668c64
* Layed out components for custom nodes. * Outline of custom nodes. Still missing various features and error handling. * Persist custom nodes to local storage. * Make custom nodes removable. * Add latest block functions, call it when switching nodes. * Initialize correct node, move node utils into utils file. * Fix names * Send headers along with rpc requests. * Remove custom network options for now. * PR feedback. * One last log. * Fix tests. * Headers in batch too. * Switch to node when you add it. * Reduce hackery. * Clean up linter and tsc. * Fix latest block hex conversion. * Unit tests. * Fix missing property. * Fix Modal title typing.
39 lines
1.0 KiB
TypeScript
39 lines
1.0 KiB
TypeScript
import {
|
|
makeCustomNodeId,
|
|
getCustomNodeConfigFromId,
|
|
getNodeConfigFromId,
|
|
makeNodeConfigFromCustomConfig
|
|
} from 'utils/node';
|
|
|
|
const custNode = {
|
|
name: 'Test Config',
|
|
url: 'http://somecustomconfig.org/',
|
|
port: 443,
|
|
network: 'ETH'
|
|
};
|
|
const custNodeId = 'http://somecustomconfig.org/:443';
|
|
|
|
describe('makeCustomNodeId', () => {
|
|
it('should construct an ID from url:port', () => {
|
|
expect(makeCustomNodeId(custNode) === custNodeId).toBeTruthy();
|
|
});
|
|
});
|
|
|
|
describe('getCustomNodeConfigFromId', () => {
|
|
it('should fetch the correct config, given its ID', () => {
|
|
expect(getCustomNodeConfigFromId(custNodeId, [custNode])).toBeTruthy();
|
|
});
|
|
});
|
|
|
|
describe('getNodeConfigFromId', () => {
|
|
it('should fetch the correct config, given its ID', () => {
|
|
expect(getNodeConfigFromId(custNodeId, [custNode])).toBeTruthy();
|
|
});
|
|
});
|
|
|
|
describe('makeNodeConfigFromCustomConfig', () => {
|
|
it('Should create a node config from a custom config', () => {
|
|
expect(makeNodeConfigFromCustomConfig(custNode)).toBeTruthy();
|
|
});
|
|
});
|