All files / src/mockProviders mockNetworkInfoProvider.ts

83.33% Statements 5/6
100% Branches 0/0
0% Functions 0/1
100% Lines 4/4

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 312x 2x   2x                               2x                      
import { genesisParameters, ledgerTip, protocolParameters } from './mockData';
import { testnetEraSummaries } from '../eraSummaries';
 
export const networkInfo = {
  lovelaceSupply: {
    circulating: 42_064_399_450_423_723n,
    total: 40_267_211_394_073_980n
  },
  network: {
    eraSummaries: testnetEraSummaries,
    magic: 1_097_911_063
  },
  stake: {
    active: 1_060_378_314_781_343n,
    live: 15_001_884_895_856_815n
  }
};
 
/** Provider stub for testing */
export const mockNetworkInfoProvider = () => ({
  eraSummaries: jest.fn().mockResolvedValue(networkInfo.network.eraSummaries),
  genesisParameters: jest.fn().mockResolvedValue(genesisParameters),
  healthCheck: jest.fn().mockResolvedValue({ ok: true }),
  ledgerTip: jest.fn().mockResolvedValue(ledgerTip),
  lovelaceSupply: jest.fn().mockResolvedValue(networkInfo.lovelaceSupply),
  protocolParameters: jest.fn().mockResolvedValue(protocolParameters),
  stake: jest.fn().mockResolvedValue(networkInfo.stake)
});
 
export type NetworkInfoProviderStub = ReturnType<typeof mockNetworkInfoProvider>;