Skip to content

Commit

Permalink
Fix mocks
Browse files Browse the repository at this point in the history
  • Loading branch information
Alejandro Fernández Gómez committed Mar 15, 2022
1 parent ce437a4 commit d0220ec
Showing 1 changed file with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,24 @@ import * as observabilityPublic from '../../../../observability/public';
import '../../lib/__mocks__/use_composite_image.mock';
import { mockRef } from '../../lib/__mocks__/screenshot_ref.mock';

jest.mock('../../../../observability/public', () => {
const originalModule = jest.requireActual('../../../../observability/public');

return {
...originalModule,
useFetcher: jest.fn().mockReturnValue({ data: null, status: 'success' }),
};
});
jest.mock('../../../../observability/public');

jest.mock('react-use/lib/useIntersection', () => () => ({
isIntersecting: true,
}));

describe('StepScreenshotDisplayProps', () => {
beforeAll(() => {
jest.spyOn(observabilityPublic, 'useFetcher').mockReturnValue({
data: null,
status: observabilityPublic.FETCH_STATUS.SUCCESS,
refetch: () => {},
});
});

afterAll(() => {
(observabilityPublic.useFetcher as any).mockClear();
});
it('displays screenshot thumbnail when present', () => {
const { getByAltText } = render(
<StepScreenshotDisplay
Expand Down

0 comments on commit d0220ec

Please sign in to comment.