Skip to content

storyblok testing

The helpers this package ships for your tests, by the path you import them from. How the test layers fit together is in the testing guide.

@evolve-framework/storyblok/testing

A test context and block registry, a mocked Storyblok API and a test executor.

configureTestRegistryInstall a fully-populated mapper registry (all content blocks) as the active module-scoped registry, so mappers that dispatch to other mappers -- columns, and any container mapping its children -- resolve during tests.
import { configureTestRegistry } from "@evolve-framework/storyblok/testing";

Returns the registry, which is also how a test should reach a block's mapper: dispatching by component name is the production path and gives a typed result.

function configureTestRegistry(): MapperRegistry

Returns MapperRegistry

createTestContextValueCreate a test context value for testing purposes
import { createTestContextValue } from "@evolve-framework/storyblok/testing";
function createTestContextValue(): ContextValue

Returns ContextValue

createTestExecutorCreate a GraphQL executor for testing purposes.
import { createTestExecutor } from "@evolve-framework/storyblok/testing";

See https://the-guild.dev/graphql/yoga-server/docs/features/testing for more information on how to use it.

function createTestExecutor(): DisposableAsyncExecutor

Returns DisposableAsyncExecutor

mswServer
import { mswServer } from "@evolve-framework/storyblok/testing";
const mswServer: SetupServer

Commands

For data in a shared environment, the package also adds these commands:

  • evolve eject: Eject built-in blocks into your project so you own them
  • evolve tf-export: Export the built-in content blocks' Terraform to disk