mirror of
https://github.com/hanzoai/sentinel.git
synced 2026-10-30 14:49:14 +00:00
79 lines
2.1 KiB
TypeScript
79 lines
2.1 KiB
TypeScript
import {OrganizationFixture} from 'sentry-fixture/organization';
|
|
|
|
import {render, screen} from 'sentry-test/reactTestingLibrary';
|
|
|
|
import {useLocation} from 'sentry/utils/useLocation';
|
|
import useOrganization from 'sentry/utils/useOrganization';
|
|
import usePageFilters from 'sentry/utils/usePageFilters';
|
|
import WebVitalsLandingPage from 'sentry/views/performance/browser/webVitals/webVitalsLandingPage';
|
|
|
|
jest.mock('sentry/utils/useLocation');
|
|
jest.mock('sentry/utils/usePageFilters');
|
|
jest.mock('sentry/utils/useOrganization');
|
|
|
|
describe('WebVitalsLandingPage', function () {
|
|
const organization = OrganizationFixture({
|
|
features: ['starfish-browser-webvitals', 'performance-database-view'],
|
|
});
|
|
|
|
beforeEach(function () {
|
|
jest.mocked(useLocation).mockReturnValue({
|
|
pathname: '',
|
|
search: '',
|
|
query: {},
|
|
hash: '',
|
|
state: undefined,
|
|
action: 'PUSH',
|
|
key: '',
|
|
});
|
|
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: [],
|
|
},
|
|
});
|
|
jest.mocked(useOrganization).mockReturnValue(organization);
|
|
|
|
MockApiClient.addMockResponse({
|
|
url: `/organizations/${organization.slug}/events/`,
|
|
body: {
|
|
data: [],
|
|
},
|
|
});
|
|
MockApiClient.addMockResponse({
|
|
url: `/organizations/${organization.slug}/events-stats/`,
|
|
body: {},
|
|
});
|
|
});
|
|
|
|
afterEach(function () {
|
|
jest.resetAllMocks();
|
|
});
|
|
|
|
it('renders performance score migration alert', async () => {
|
|
jest.mocked(useLocation).mockReturnValue({
|
|
pathname: '',
|
|
search: '',
|
|
query: {useStoredScores: 'true'},
|
|
hash: '',
|
|
state: undefined,
|
|
action: 'PUSH',
|
|
key: '',
|
|
});
|
|
render(<WebVitalsLandingPage />);
|
|
await screen.findByText(
|
|
/We made improvements to how Performance Scores are calculated for your projects/
|
|
);
|
|
});
|
|
});
|