Skip to content

Files

Latest commit

71edf37 · Jun 15, 2020

History

History

testing

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Jun 12, 2020
Jun 12, 2020
Jun 9, 2020
May 7, 2020
Jun 10, 2020
May 15, 2020
May 15, 2020
Jun 15, 2020
Jan 21, 2020

testing @libp2p/observer-testing

This package contains testing utilities to ease development of libp2p Observer widgets and the libp2p Observer project itself.

Environments

This package may be used for both jest tests running in node.js and for in-browsing demoing with Storybook, and has different entry points for each case:

Use in node.js in jest

Through the main entrypoint, index.test.js, this exports:

  • A function loadSample that loads sample data using Node.js's readFile API
  • Context-providing wrapper components that load sample data using loadSample
  • mock-messages - functions that return simple objects that can pass as mock event, runtime and state messages without causing errors
  • test-utils for use with React Testing Library and Jest, including custom queries and a utility function to simulate nudging the timeline slider by one

Use in browsers with storybook

Through the browser entrypoint, index.browser.js, this exports:

  • A function fetchSample that loads sample data using a browser's fetch API
  • Context-providing wrapper components that load sample data using fetchSample
  • mock-messages - functions that return simple objects that can pass as mock event, runtime and state messages without causing errors