Skip to content
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
1 change: 1 addition & 0 deletions eslint.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -875,6 +875,7 @@ export default typescript.config([
'error',
{additionalTestBlockFunctions: ['it.isKnownFlake']},
],
'jest/prefer-jest-mocked': 'error',

'jest/expect-expect': 'off', // Disabled as we have many tests which render as simple validations
'jest/no-conditional-expect': 'off', // TODO(ryan953): Fix violations then delete this line
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jest.mock('@sentry/scraps/button', () => ({

jest.mock('sentry/components/events/autofix/useAutofix');

const mockButton = Button as jest.MockedFunction<typeof Button>;
const mockButton = jest.mocked(Button);

describe('AutofixChanges', () => {
const defaultProps = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,7 @@ describe('projectGeneralSettings', () => {
})
);

const addSuccessMessageMock = addSuccessMessage as jest.MockedFunction<
typeof addSuccessMessage
>;
const addSuccessMessageMock = jest.mocked(addSuccessMessage);
const undo = addSuccessMessageMock.mock.calls[0]?.[1]?.undo;

expect(undo).toBeInstanceOf(Function);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,9 +333,7 @@ describe('ProductSelectionAvailability', () => {
},
};

const MockUsePreviewData = usePreviewData as jest.MockedFunction<
typeof usePreviewData
>;
const MockUsePreviewData = jest.mocked(usePreviewData);
const mockReservations: Reservations = {
reservedErrors: 50000,
reservedTransactions: 0,
Expand Down
4 changes: 1 addition & 3 deletions static/gsApp/components/productUnavailableCTA.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,7 @@ describe('ProductUnavailableCTA', () => {
canSelfServe: true,
});

const MockUsePreviewData = usePreviewData as jest.MockedFunction<
typeof usePreviewData
>;
const MockUsePreviewData = jest.mocked(usePreviewData);
const mockReservations: Reservations = {
reservedErrors: 50000,
reservedTransactions: 0,
Expand Down
2 changes: 1 addition & 1 deletion static/gsApp/utils/rawTrackAnalyticsEvent.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe('rawTrackAnalyticsEvent', () => {
const org_id = Number(organization.id);

beforeEach(() => {
(uniqueId as jest.MockedFunction<typeof uniqueId>).mockReturnValue('345');
jest.mocked(uniqueId).mockReturnValue('345');
});

afterEach(() => {
Expand Down
Loading