storybook/docs/_snippets/portable-stories-jest-with-loaders.md
2024-06-13 17:53:08 +01:00

1.0 KiB

import { test } from '@jest/globals';
import { render } from '@testing-library/react';
// 👉 Using Next.js? Import from @storybook/nextjs instead
import { composeStory } from '@storybook/react';

import meta, { Primary } from './Button.stories';

test('applies the loaders and renders', async () => {
  const PrimaryStory = composeStory(Primary, meta);

  // First, load the data for the story
  await PrimaryStory.load();

  // Then, render the story
  render(<PrimaryStory />);
});
import { test } from '@jest/globals';
import { render } from '@testing-library/vue';
import { composeStory } from '@storybook/vue3';

import meta, { Primary } from './Button.stories';

test('applies the loaders and renders', async () => {
  const PrimaryStory = composeStory(Primary, meta);

  // First, load the data for the story
  await PrimaryStory.load();

  // Then, render the story
  render(PrimaryStory);
});