Skip to content

Commit

Permalink
move enabledIntervals tests
Browse files Browse the repository at this point in the history
  • Loading branch information
thmsobrmlr committed Oct 29, 2023
1 parent bb3f9ff commit 41d382a
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 78 deletions.

This file was deleted.

45 changes: 45 additions & 0 deletions frontend/src/scenes/insights/insightVizDataLogic.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -302,4 +302,49 @@ describe('insightVizDataLogic', () => {
}).toMatchValues({ activeUsersMath: BaseMathType.MonthlyActiveUsers })
})
})

describe('enabledIntervals', () => {
it('returns all intervals', () => {
expectLogic(builtInsightVizDataLogic).toMatchValues({
enabledIntervals: {
day: { label: 'day', newDateFrom: undefined },
hour: { label: 'hour', newDateFrom: 'dStart' },
month: { label: 'month', newDateFrom: '-90d' },
week: { label: 'week', newDateFrom: '-30d' },
},
})
})

it('adds a disabled reason with active users math', () => {
expectLogic(builtInsightVizDataLogic, () => {
builtInsightVizDataLogic.actions.updateQuerySource({
series: [
{
kind: 'EventsNode',
name: '$pageview',
event: '$pageview',
math: BaseMathType.WeeklyActiveUsers,
},
],
} as Partial<TrendsQuery>)
}).toMatchValues({
enabledIntervals: {
day: { label: 'day', newDateFrom: undefined },
hour: {
label: 'hour',
newDateFrom: 'dStart',
disabledReason:
'Grouping by hour is not supported on insights with weekly or monthly active users series.',
},
month: {
label: 'month',
newDateFrom: '-90d',
disabledReason:
'Grouping by month is not supported on insights with weekly active users series.',
},
week: { label: 'week', newDateFrom: '-30d' },
},
})
})
})
})

0 comments on commit 41d382a

Please sign in to comment.