mirror of
https://github.com/hanzoai/sentinel.git
synced 2026-10-30 14:49:14 +00:00
51 lines
1.7 KiB
TypeScript
51 lines
1.7 KiB
TypeScript
import {OrganizationFixture} from 'sentry-fixture/organization';
|
|
import {ProjectFixture} from 'sentry-fixture/project';
|
|
import {RouterContextFixture} from 'sentry-fixture/routerContextFixture';
|
|
|
|
import {render, screen} from 'sentry-test/reactTestingLibrary';
|
|
|
|
import ProjectsStore from 'sentry/stores/projectsStore';
|
|
import TeamInsightsContainer from 'sentry/views/organizationStats/teamInsights';
|
|
|
|
describe('TeamInsightsContainer', () => {
|
|
afterEach(() => {
|
|
ProjectsStore.reset();
|
|
});
|
|
|
|
it('blocks access if org is missing flag', () => {
|
|
const organization = OrganizationFixture();
|
|
const context = RouterContextFixture([{organization}]);
|
|
render(
|
|
<TeamInsightsContainer organization={organization}>
|
|
<div>test</div>
|
|
</TeamInsightsContainer>,
|
|
{context}
|
|
);
|
|
|
|
expect(screen.queryByText('test')).not.toBeInTheDocument();
|
|
});
|
|
it('allows access for orgs with flag', () => {
|
|
ProjectsStore.loadInitialData([ProjectFixture()]);
|
|
const organization = OrganizationFixture({features: ['team-insights']});
|
|
const context = RouterContextFixture([{organization}]);
|
|
render(
|
|
<TeamInsightsContainer organization={organization}>
|
|
<div>test</div>
|
|
</TeamInsightsContainer>,
|
|
{context}
|
|
);
|
|
|
|
expect(screen.getByText('test')).toBeInTheDocument();
|
|
});
|
|
it('shows message for users with no teams', () => {
|
|
ProjectsStore.loadInitialData([]);
|
|
const organization = OrganizationFixture({features: ['team-insights']});
|
|
const context = RouterContextFixture([{organization}]);
|
|
render(<TeamInsightsContainer organization={organization} />, {context});
|
|
|
|
expect(
|
|
screen.getByText('You need at least one project to use this view')
|
|
).toBeInTheDocument();
|
|
});
|
|
});
|