-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(insights): customers not seeing empty state screen on developer p…
…lan (#81808)
- Loading branch information
1 parent
b815847
commit ee058ef
Showing
9 changed files
with
158 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
static/app/views/insights/common/components/modulePageProviders.spec.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import {OrganizationFixture} from 'sentry-fixture/organization'; | ||
|
||
import {render, screen} from 'sentry-test/reactTestingLibrary'; | ||
|
||
import usePageFilters from 'sentry/utils/usePageFilters'; | ||
import {ModulePageProviders} from 'sentry/views/insights/common/components/modulePageProviders'; | ||
import {useHasFirstSpan} from 'sentry/views/insights/common/queries/useHasFirstSpan'; | ||
import {ModuleName} from 'sentry/views/insights/types'; | ||
|
||
jest.mock('sentry/utils/usePageFilters'); | ||
jest.mock('sentry/views/insights/common/queries/useHasFirstSpan'); | ||
jest.mock('sentry/views/insights/common/utils/useHasDataTrackAnalytics'); | ||
|
||
describe('ModulePageProviders', () => { | ||
beforeEach(() => { | ||
jest.mocked(usePageFilters).mockReturnValue({ | ||
isReady: true, | ||
desyncedFilters: new Set(), | ||
pinnedFilters: new Set(), | ||
shouldPersist: true, | ||
selection: { | ||
datetime: { | ||
period: '10d', | ||
start: null, | ||
end: null, | ||
utc: false, | ||
}, | ||
environments: [], | ||
projects: [2], | ||
}, | ||
}); | ||
}); | ||
|
||
afterEach(() => { | ||
jest.resetAllMocks(); | ||
}); | ||
|
||
it('renders without module feature', async () => { | ||
jest.mocked(useHasFirstSpan).mockReturnValue(true); | ||
|
||
render( | ||
<ModulePageProviders moduleName={ModuleName.DB}> | ||
<div>Module Content</div> | ||
</ModulePageProviders>, | ||
{ | ||
organization: OrganizationFixture(), | ||
} | ||
); | ||
|
||
await screen.findByText('Module Content'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
static/app/views/insights/common/components/moduleUpsellHookWrapper.spec.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import {OrganizationFixture} from 'sentry-fixture/organization'; | ||
|
||
import {render, screen} from 'sentry-test/reactTestingLibrary'; | ||
|
||
import {ModuleBodyUpsellHook} from 'sentry/views/insights/common/components/moduleUpsellHookWrapper'; | ||
import {ModuleName} from 'sentry/views/insights/types'; | ||
|
||
jest.mock('sentry/utils/usePageFilters'); | ||
|
||
describe('ModulePageProviders', () => { | ||
afterEach(() => { | ||
jest.resetAllMocks(); | ||
}); | ||
|
||
it('renders no feature if module is not enabled', async () => { | ||
render( | ||
<ModuleBodyUpsellHook moduleName={ModuleName.DB}> | ||
<div>Module Content</div> | ||
</ModuleBodyUpsellHook>, | ||
{ | ||
organization: OrganizationFixture({ | ||
features: ['insights-entry-points'], | ||
}), | ||
} | ||
); | ||
|
||
await screen.findByText(`You don't have access to this feature`); | ||
}); | ||
|
||
it('renders module content if module is enabled', async () => { | ||
render( | ||
<ModuleBodyUpsellHook moduleName={ModuleName.DB}> | ||
<div>Module Content</div> | ||
</ModuleBodyUpsellHook>, | ||
{ | ||
organization: OrganizationFixture({ | ||
features: ['insights-initial-modules'], | ||
}), | ||
} | ||
); | ||
|
||
await screen.findByText(`Module Content`); | ||
}); | ||
}); |
15 changes: 13 additions & 2 deletions
15
static/app/views/insights/common/components/moduleUpsellHookWrapper.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters