Skip to content

Commit

Permalink
Add a story to test streaming in list rules
Browse files Browse the repository at this point in the history
  • Loading branch information
MytsV committed Sep 15, 2024
1 parent dcc1910 commit 7a6e864
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/component-library/pages/Rule/list/ListRule.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import {StoryFn, Meta} from '@storybook/react';
import {fixtureRuleViewModel} from '@/test/fixtures/table-fixtures';
import {ListRule} from "@/component-library/pages/Rule/list/ListRule";
import {ToastedTemplate} from "@/component-library/templates/ToastedTemplate/ToastedTemplate";
import {getDecoratorWithWorker} from "@/test/mocks/handlers/story-decorators";
import {getMockStreamEndpoint} from "@/test/mocks/handlers/streaming-handlers";

export default {
title: 'Components/Pages/Rule/List',
Expand All @@ -12,7 +14,17 @@ const Template: StoryFn<typeof ListRule> = args => <ToastedTemplate>
<ListRule {...args} />
</ToastedTemplate>;

export const InitialData = Template.bind({});
InitialData.args = {
export const InitialDataNoEndpoint = Template.bind({});
InitialDataNoEndpoint.args = {
initialData: Array.from({length: 50}, () => fixtureRuleViewModel()),
}

export const RegularStreaming = Template.bind({});
RegularStreaming.decorators = [
getDecoratorWithWorker([
getMockStreamEndpoint('/api/feature/list-rules', {
data: Array.from({length: 500}, fixtureRuleViewModel),
delay: 1,
}),
]),
];

0 comments on commit 7a6e864

Please sign in to comment.