Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@blockfrost/blockfrost-tests

Package Overview
Dependencies
Maintainers
3
Versions
96
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@blockfrost/blockfrost-tests

latest
Source
npmnpm
Version
1.12.0
Version published
Maintainers
3
Created
Source

Blockfrost Integration Tests


You have three options how to run the tests.

  • mainnet network - yarn test:mainnet
  • preview network - yarn test:preview
  • preprod network - yarn test:preprod
  • ipfs network - yarn test:ipfs

-t or --testNamePattern - run only tests with matching name

You can use a different environment variables to tweak the tests behaviour.

  • SERVER_URL where to run the tests | default: localhost:3000
  • PROJECT_ID set the header with token to use in every test
  • IS_CACHED (true = DISABLED IN RYO)
    • undefined: default - use all fixtures
    • true - use fixtures with flag isCached: true
    • false - use fixtures with flag isCached: false
  • CACHED_ONLY - use only cached fixtures

Command exmaple

SERVER_URL=https://cardano-mainnet.blockfrost.io/api/v0/ PROJECT_ID=mainnetLZgT76GL3subckxt9Y1G8niouSCVwWtn yarn test:mainnet -t addresses/:address/utxos;

Fixture sample

import { expect } from 'vitest';

export default [
  {
    testName:
      'blocks/slot/:slot_number and blocks/epoch/:epoch_number/slot/:slot_number - generic shelley',
    endpoints: ['blocks/slot/16019999', 'blocks/epoch/234/slot/295199'],
    response: {
      time: 1607586290,
      height: 5058628,
      hash: '5d3df361b77ba7aff50a00ace1f00cec23126aa3b67af775dbf70c88c7e85ca4',
      slot: 16019999,
      epoch: 234,
      epoch_slot: 295199,
      slot_leader: 'pool1x0qm7xsyh2za3ltprxsgael544je4hg8tc3q3v5gv232z8jt4wp',
      size: 392,
      tx_count: 1,
      output: '6225908',
      fees: '173025',
      block_vrf: 'vrf_vk17hff333krucx82wjdhnwnfvusg8p4zn22lwmf2pmd2e5mghu52hqvpf8qj',
      previous_block: '7ee80a3c33b7ebb876671a936f57ec79f02a8b44a5132033c8860137e1c01c13',
      next_block: '94f96c20547b47e9668d5f42c88d0d3b92700c2614ec9bb3ad683bb0bba471f6',
      confirmations: expect.any(Number),
    },
  },
];

FAQs

Package last updated on 11 Feb 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts