This package contains testing utilities to ease development of libp2p Observer widgets and the libp2p Observer project itself.
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:
Through the main
entrypoint, index.test.js, this exports:
- A function
loadSample
that loads sample data using Node.js'sreadFile
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
andstate
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
Through the browser
entrypoint, index.browser.js, this exports:
- A function
fetchSample
that loads sample data using a browser'sfetch
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
andstate
messages without causing errors