Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(mocks): move mocks to shared folder (closes #16192) #17117

Merged
merged 14 commits into from
Aug 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good except still a NaN here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops.. fixed it for real now. Problem was that the insight short_id was reused across the insights in the cards. They have unique short_ids now.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
74 changes: 49 additions & 25 deletions frontend/src/exporter/Exporter.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,83 +38,107 @@ const Template: StoryFn<typeof Exporter> = (props) => {
}

export const TrendsLineInsight: Story = Template.bind({})
TrendsLineInsight.args = { insight: require('../scenes/insights/__mocks__/trendsLine.json') }
TrendsLineInsight.args = { insight: require('../mocks/fixtures/api/projects/:team_id/insights/trendsLine.json') }

export const TrendsLineBreakdownInsight: Story = Template.bind({})
TrendsLineBreakdownInsight.args = { insight: require('../scenes/insights/__mocks__/trendsLineBreakdown.json') }
TrendsLineBreakdownInsight.args = {
insight: require('../mocks/fixtures/api/projects/:team_id/insights/trendsLineBreakdown.json'),
}

export const TrendsBarInsight: Story = Template.bind({})
TrendsBarInsight.args = { insight: require('../scenes/insights/__mocks__/trendsBar.json') }
TrendsBarInsight.args = { insight: require('../mocks/fixtures/api/projects/:team_id/insights/trendsBar.json') }

export const TrendsBarBreakdownInsight: Story = Template.bind({})
TrendsBarBreakdownInsight.args = { insight: require('../scenes/insights/__mocks__/trendsBarBreakdown.json') }
TrendsBarBreakdownInsight.args = {
insight: require('../mocks/fixtures/api/projects/:team_id/insights/trendsBarBreakdown.json'),
}

export const TrendsValueInsight: Story = Template.bind({})
TrendsValueInsight.args = { insight: require('../scenes/insights/__mocks__/trendsValue.json') }
TrendsValueInsight.args = { insight: require('../mocks/fixtures/api/projects/:team_id/insights/trendsValue.json') }

export const TrendsValueBreakdownInsight: Story = Template.bind({})
TrendsValueBreakdownInsight.args = { insight: require('../scenes/insights/__mocks__/trendsValueBreakdown.json') }
TrendsValueBreakdownInsight.args = {
insight: require('../mocks/fixtures/api/projects/:team_id/insights/trendsValueBreakdown.json'),
}

export const TrendsAreaInsight: Story = Template.bind({})
TrendsAreaInsight.args = { insight: require('../scenes/insights/__mocks__/trendsArea.json') }
TrendsAreaInsight.args = { insight: require('../mocks/fixtures/api/projects/:team_id/insights/trendsArea.json') }

export const TrendsAreaBreakdownInsight: Story = Template.bind({})
TrendsAreaBreakdownInsight.args = { insight: require('../scenes/insights/__mocks__/trendsAreaBreakdown.json') }
TrendsAreaBreakdownInsight.args = {
insight: require('../mocks/fixtures/api/projects/:team_id/insights/trendsAreaBreakdown.json'),
}

export const TrendsNumberInsight: Story = Template.bind({})
TrendsNumberInsight.args = { insight: require('../scenes/insights/__mocks__/trendsNumber.json') }
TrendsNumberInsight.args = { insight: require('../mocks/fixtures/api/projects/:team_id/insights/trendsNumber.json') }

export const TrendsTableInsight: Story = Template.bind({})
TrendsTableInsight.args = { insight: require('../scenes/insights/__mocks__/trendsTable.json') }
TrendsTableInsight.args = { insight: require('../mocks/fixtures/api/projects/:team_id/insights/trendsTable.json') }

export const TrendsTableBreakdownInsight: Story = Template.bind({})
TrendsTableBreakdownInsight.args = { insight: require('../scenes/insights/__mocks__/trendsTableBreakdown.json') }
TrendsTableBreakdownInsight.args = {
insight: require('../mocks/fixtures/api/projects/:team_id/insights/trendsTableBreakdown.json'),
}

export const TrendsPieInsight: Story = Template.bind({})
TrendsPieInsight.args = { insight: require('../scenes/insights/__mocks__/trendsPie.json') }
TrendsPieInsight.args = { insight: require('../mocks/fixtures/api/projects/:team_id/insights/trendsPie.json') }

export const TrendsPieBreakdownInsight: Story = Template.bind({})
TrendsPieBreakdownInsight.args = { insight: require('../scenes/insights/__mocks__/trendsPieBreakdown.json') }
TrendsPieBreakdownInsight.args = {
insight: require('../mocks/fixtures/api/projects/:team_id/insights/trendsPieBreakdown.json'),
}

export const TrendsWorldMapInsight: Story = Template.bind({})
TrendsWorldMapInsight.args = { insight: require('../scenes/insights/__mocks__/trendsWorldMap.json') }
TrendsWorldMapInsight.args = {
insight: require('../mocks/fixtures/api/projects/:team_id/insights/trendsWorldMap.json'),
}

export const FunnelLeftToRightInsight: Story = Template.bind({})
FunnelLeftToRightInsight.args = { insight: require('../scenes/insights/__mocks__/funnelLeftToRight.json') }
FunnelLeftToRightInsight.args = {
insight: require('../mocks/fixtures/api/projects/:team_id/insights/funnelLeftToRight.json'),
}

export const FunnelLeftToRightBreakdownInsight: Story = Template.bind({})
FunnelLeftToRightBreakdownInsight.args = {
insight: require('../scenes/insights/__mocks__/funnelLeftToRightBreakdown.json'),
insight: require('../mocks/fixtures/api/projects/:team_id/insights/funnelLeftToRightBreakdown.json'),
}

export const FunnelTopToBottomInsight: Story = Template.bind({})
FunnelTopToBottomInsight.args = { insight: require('../scenes/insights/__mocks__/funnelTopToBottom.json') }
FunnelTopToBottomInsight.args = {
insight: require('../mocks/fixtures/api/projects/:team_id/insights/funnelTopToBottom.json'),
}

export const FunnelTopToBottomBreakdownInsight: Story = Template.bind({})
FunnelTopToBottomBreakdownInsight.args = {
insight: require('../scenes/insights/__mocks__/funnelTopToBottomBreakdown.json'),
insight: require('../mocks/fixtures/api/projects/:team_id/insights/funnelTopToBottomBreakdown.json'),
}

export const FunnelHistoricalTrendsInsight: Story = Template.bind({})
FunnelHistoricalTrendsInsight.args = { insight: require('../scenes/insights/__mocks__/funnelHistoricalTrends.json') }
FunnelHistoricalTrendsInsight.args = {
insight: require('../mocks/fixtures/api/projects/:team_id/insights/funnelHistoricalTrends.json'),
}

export const FunnelTimeToConvertInsight: Story = Template.bind({})
FunnelTimeToConvertInsight.args = { insight: require('../scenes/insights/__mocks__/funnelTimeToConvert.json') }
FunnelTimeToConvertInsight.args = {
insight: require('../mocks/fixtures/api/projects/:team_id/insights/funnelTimeToConvert.json'),
}

export const RetentionInsight: Story = Template.bind({})
RetentionInsight.args = { insight: require('../scenes/insights/__mocks__/retention.json') }
RetentionInsight.args = { insight: require('../mocks/fixtures/api/projects/:team_id/insights/retention.json') }

export const RetentionBreakdownInsight: Story = Template.bind({})
RetentionBreakdownInsight.args = { insight: require('../scenes/insights/__mocks__/retentionBreakdown.json') }
RetentionBreakdownInsight.args = {
insight: require('../mocks/fixtures/api/projects/:team_id/insights/retentionBreakdown.json'),
}

export const LifecycleInsight: Story = Template.bind({})
LifecycleInsight.args = { insight: require('../scenes/insights/__mocks__/lifecycle.json') }
LifecycleInsight.args = { insight: require('../mocks/fixtures/api/projects/:team_id/insights/lifecycle.json') }

export const StickinessInsight: Story = Template.bind({})
StickinessInsight.args = { insight: require('../scenes/insights/__mocks__/stickiness.json') }
StickinessInsight.args = { insight: require('../mocks/fixtures/api/projects/:team_id/insights/stickiness.json') }

export const UserPathsInsight: Story = Template.bind({})
UserPathsInsight.args = { insight: require('../scenes/insights/__mocks__/userPaths.json') }
UserPathsInsight.args = { insight: require('../mocks/fixtures/api/projects/:team_id/insights/userPaths.json') }

export const Dashboard: Story = Template.bind({})
Dashboard.args = { dashboard }
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ import { useState } from 'react'
import { ChartDisplayType, InsightColor, InsightModel, InsightShortId, TrendsFilterType } from '~/types'
import { InsightCard as InsightCardComponent } from './index'

import EXAMPLE_TRENDS from './__mocks__/trends.json'
import EXAMPLE_TRENDS_HORIZONTAL_BAR from './__mocks__/trendsHorizontalBar.json'
import EXAMPLE_TRENDS_TABLE from './__mocks__/trendsTable.json'
import EXAMPLE_TRENDS_PIE from './__mocks__/trendsPie.json'
import EXAMPLE_TRENDS_WORLD_MAP from './__mocks__/trendsWorldMap.json'
import EXAMPLE_FUNNEL from './__mocks__/funnel.json'
import EXAMPLE_RETENTION from './__mocks__/retention.json'
import EXAMPLE_PATHS from './__mocks__/paths.json'
import EXAMPLE_STICKINESS from './__mocks__/stickiness.json'
import EXAMPLE_LIFECYCLE from './__mocks__/lifecycle.json'
import EXAMPLE_DATA_TABLE_NODE_HOGQL_QUERY from './__mocks__/dataTableHogQL.json'
import EXAMPLE_DATA_TABLE_NODE_EVENTS_QUERY from './__mocks__/dataTableEvents.json'
import EXAMPLE_TRENDS from '../../../../mocks/fixtures/api/projects/:team_id/insights/trendsLine.json'
import EXAMPLE_TRENDS_HORIZONTAL_BAR from '../../../../mocks/fixtures/api/projects/:team_id/insights/trendsValue.json'
import EXAMPLE_TRENDS_TABLE from '../../../../mocks/fixtures/api/projects/:team_id/insights/trendsTable.json'
import EXAMPLE_TRENDS_PIE from '../../../../mocks/fixtures/api/projects/:team_id/insights/trendsPie.json'
import EXAMPLE_TRENDS_WORLD_MAP from '../../../../mocks/fixtures/api/projects/:team_id/insights/trendsWorldMap.json'
import EXAMPLE_FUNNEL from '../../../../mocks/fixtures/api/projects/:team_id/insights/funnelLeftToRight.json'
import EXAMPLE_RETENTION from '../../../../mocks/fixtures/api/projects/:team_id/insights/retention.json'
import EXAMPLE_PATHS from '../../../../mocks/fixtures/api/projects/:team_id/insights/userPaths.json'
import EXAMPLE_STICKINESS from '../../../../mocks/fixtures/api/projects/:team_id/insights/stickiness.json'
import EXAMPLE_LIFECYCLE from '../../../../mocks/fixtures/api/projects/:team_id/insights/lifecycle.json'
import EXAMPLE_DATA_TABLE_NODE_HOGQL_QUERY from '../../../../mocks/fixtures/api/projects/:team_id/insights/dataTableHogQL.json'
import EXAMPLE_DATA_TABLE_NODE_EVENTS_QUERY from '../../../../mocks/fixtures/api/projects/:team_id/insights/dataTableEvents.json'

const examples = [
EXAMPLE_TRENDS,
Expand Down

This file was deleted.

Loading