@yoroi/explorers
Version:
The Explorers package of Yoroi SDK
127 lines (126 loc) • 8.63 kB
JavaScript
"use strict";
var _types = require("@yoroi/types");
var _explorerManager = require("./explorer-manager");
describe('explorerManager', () => {
it('should have the correct structure', () => {
expect(_explorerManager.explorerManager).toEqual({
[_types.Chain.Network.Mainnet]: {
[_types.Explorers.Explorer.CardanoScan]: {
token: expect.any(Function),
address: expect.any(Function),
tx: expect.any(Function),
pool: expect.any(Function),
stake: expect.any(Function)
},
[_types.Explorers.Explorer.CExplorer]: {
token: expect.any(Function),
address: expect.any(Function),
tx: expect.any(Function),
pool: expect.any(Function),
stake: expect.any(Function)
}
},
[_types.Chain.Network.Preprod]: {
[_types.Explorers.Explorer.CardanoScan]: {
token: expect.any(Function),
address: expect.any(Function),
tx: expect.any(Function),
pool: expect.any(Function),
stake: expect.any(Function)
},
[_types.Explorers.Explorer.CExplorer]: {
token: expect.any(Function),
address: expect.any(Function),
tx: expect.any(Function),
pool: expect.any(Function),
stake: expect.any(Function)
}
},
[_types.Chain.Network.Sancho]: {
[_types.Explorers.Explorer.CardanoScan]: {
token: expect.any(Function),
address: expect.any(Function),
tx: expect.any(Function),
pool: expect.any(Function),
stake: expect.any(Function)
},
[_types.Explorers.Explorer.CExplorer]: {
token: expect.any(Function),
address: expect.any(Function),
tx: expect.any(Function),
pool: expect.any(Function),
stake: expect.any(Function)
}
},
[_types.Chain.Network.Preview]: {
[_types.Explorers.Explorer.CardanoScan]: {
token: expect.any(Function),
address: expect.any(Function),
tx: expect.any(Function),
pool: expect.any(Function),
stake: expect.any(Function)
},
[_types.Explorers.Explorer.CExplorer]: {
token: expect.any(Function),
address: expect.any(Function),
tx: expect.any(Function),
pool: expect.any(Function),
stake: expect.any(Function)
}
}
});
});
it('should generate the correct URLs for Mainnet', () => {
const mainnetExplorer = _explorerManager.explorerManager[_types.Chain.Network.Mainnet];
expect(mainnetExplorer[_types.Explorers.Explorer.CardanoScan].token('fingerprint')).toBe('https://cardanoscan.io/token/fingerprint');
expect(mainnetExplorer[_types.Explorers.Explorer.CardanoScan].address('address')).toBe('https://cardanoscan.io/address/address');
expect(mainnetExplorer[_types.Explorers.Explorer.CardanoScan].tx('txHash')).toBe('https://cardanoscan.io/transaction/txHash');
expect(mainnetExplorer[_types.Explorers.Explorer.CardanoScan].pool('poolId')).toBe('https://cardanoscan.io/pool/poolId');
expect(mainnetExplorer[_types.Explorers.Explorer.CardanoScan].stake('stakeAddress')).toBe('https://cardanoscan.io/stakeKey/stakeAddress');
expect(mainnetExplorer[_types.Explorers.Explorer.CExplorer].token('fingerprint')).toBe('https://cexplorer.io/asset/fingerprint');
expect(mainnetExplorer[_types.Explorers.Explorer.CExplorer].address('address')).toBe('https://cexplorer.io/address/address');
expect(mainnetExplorer[_types.Explorers.Explorer.CExplorer].tx('txHash')).toBe('https://cexplorer.io/tx/txHash');
expect(mainnetExplorer[_types.Explorers.Explorer.CExplorer].pool('poolId')).toBe('https://cexplorer.io/pool/poolId');
expect(mainnetExplorer[_types.Explorers.Explorer.CExplorer].stake('stakeAddress')).toBe('https://cexplorer.io/stake/stakeAddress');
});
it('should generate the correct URLs for Preprod', () => {
const preprodExplorer = _explorerManager.explorerManager[_types.Chain.Network.Preprod];
expect(preprodExplorer[_types.Explorers.Explorer.CardanoScan].token('fingerprint')).toBe('https://preprod.cardanoscan.io/token/fingerprint');
expect(preprodExplorer[_types.Explorers.Explorer.CardanoScan].address('address')).toBe('https://preprod.cardanoscan.io/address/address');
expect(preprodExplorer[_types.Explorers.Explorer.CardanoScan].tx('txHash')).toBe('https://preprod.cardanoscan.io/transaction/txHash');
expect(preprodExplorer[_types.Explorers.Explorer.CardanoScan].pool('poolId')).toBe('https://preprod.cardanoscan.io/pool/poolId');
expect(preprodExplorer[_types.Explorers.Explorer.CardanoScan].stake('stakeAddress')).toBe('https://preprod.cardanoscan.io/stakeKey/stakeAddress');
expect(preprodExplorer[_types.Explorers.Explorer.CExplorer].token('fingerprint')).toBe('https://preprod.cexplorer.io/asset/fingerprint');
expect(preprodExplorer[_types.Explorers.Explorer.CExplorer].address('address')).toBe('https://preprod.cexplorer.io/address/address');
expect(preprodExplorer[_types.Explorers.Explorer.CExplorer].tx('txHash')).toBe('https://preprod.cexplorer.io/tx/txHash');
expect(preprodExplorer[_types.Explorers.Explorer.CExplorer].pool('poolId')).toBe('https://preprod.cexplorer.io/pool/poolId');
expect(preprodExplorer[_types.Explorers.Explorer.CExplorer].stake('stakeAddress')).toBe('https://preprod.cexplorer.io/stake/stakeAddress');
});
it('should generate the correct URLs for Sancho', () => {
const sanchoExplorer = _explorerManager.explorerManager[_types.Chain.Network.Sancho];
expect(sanchoExplorer[_types.Explorers.Explorer.CardanoScan].token('fingerprint')).toBe('https://sancho.cardanoscan.io/token/fingerprint');
expect(sanchoExplorer[_types.Explorers.Explorer.CardanoScan].address('address')).toBe('https://sancho.cardanoscan.io/address/address');
expect(sanchoExplorer[_types.Explorers.Explorer.CardanoScan].tx('txHash')).toBe('https://sancho.cardanoscan.io/transaction/txHash');
expect(sanchoExplorer[_types.Explorers.Explorer.CardanoScan].pool('poolId')).toBe('https://sancho.cardanoscan.io/pool/poolId');
expect(sanchoExplorer[_types.Explorers.Explorer.CardanoScan].stake('stakeAddress')).toBe('https://sancho.cardanoscan.io/stakeKey/stakeAddress');
expect(sanchoExplorer[_types.Explorers.Explorer.CExplorer].token('fingerprint')).toBe('https://sancho.cexplorer.io/asset/fingerprint');
expect(sanchoExplorer[_types.Explorers.Explorer.CExplorer].address('address')).toBe('https://sancho.cexplorer.io/address/address');
expect(sanchoExplorer[_types.Explorers.Explorer.CExplorer].tx('txHash')).toBe('https://sancho.cexplorer.io/tx/txHash');
expect(sanchoExplorer[_types.Explorers.Explorer.CExplorer].pool('poolId')).toBe('https://sancho.cexplorer.io/pool/poolId');
expect(sanchoExplorer[_types.Explorers.Explorer.CExplorer].stake('stakeAddress')).toBe('https://sancho.cexplorer.io/stake/stakeAddress');
});
it('should generate the correct URLs for Preview', () => {
const previewExplorer = _explorerManager.explorerManager[_types.Chain.Network.Preview];
expect(previewExplorer[_types.Explorers.Explorer.CardanoScan].token('fingerprint')).toBe('https://preview.cardanoscan.io/token/fingerprint');
expect(previewExplorer[_types.Explorers.Explorer.CardanoScan].address('address')).toBe('https://preview.cardanoscan.io/address/address');
expect(previewExplorer[_types.Explorers.Explorer.CardanoScan].tx('txHash')).toBe('https://preview.cardanoscan.io/transaction/txHash');
expect(previewExplorer[_types.Explorers.Explorer.CardanoScan].pool('poolId')).toBe('https://preview.cardanoscan.io/pool/poolId');
expect(previewExplorer[_types.Explorers.Explorer.CardanoScan].stake('stakeAddress')).toBe('https://preview.cardanoscan.io/stakeKey/stakeAddress');
expect(previewExplorer[_types.Explorers.Explorer.CExplorer].token('fingerprint')).toBe('https://preview.cexplorer.io/asset/fingerprint');
expect(previewExplorer[_types.Explorers.Explorer.CExplorer].address('address')).toBe('https://preview.cexplorer.io/address/address');
expect(previewExplorer[_types.Explorers.Explorer.CExplorer].tx('txHash')).toBe('https://preview.cexplorer.io/tx/txHash');
expect(previewExplorer[_types.Explorers.Explorer.CExplorer].pool('poolId')).toBe('https://preview.cexplorer.io/pool/poolId');
expect(previewExplorer[_types.Explorers.Explorer.CExplorer].stake('stakeAddress')).toBe('https://preview.cexplorer.io/stake/stakeAddress');
});
});
//# sourceMappingURL=explorer-manager.test.js.map