Open floratmin opened 7 months ago
I figured out a basic solution:
import {describe, it, expect} from 'vitest';
import Meta, {Primary} from './Button.stories';
import {Button} from './Button.tsx';
import {render} from '@solidjs/testing-library';
describe('It should create test on stories', () => {
it('Tests stories', async () => {
const args = {
...('args' in Meta ? (Meta as unknown as {args: Record<string, any>}).args : {}),
...('args' in Primary ? (Primary as unknown as {args: Record<string, any>}).args : {}),
backgroundColor: 'blue',
};
const renderedStory = render(() => <Button {...args} />).container;
expect(renderedStory).toHaveTextContent('Button');
});
});
I tried the equivalent function to the react library but
composeStory
does not render to screen.