@yoroi/explorers
Version:
The Explorers package of Yoroi SDK
98 lines (97 loc) • 6.55 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.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 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