shlink-web-client/test/__mocks__/Window.mock.ts

19 lines
407 B
TypeScript
Raw Normal View History

import { fromAny, fromPartial } from '@total-typescript/shoehorn';
2021-09-19 11:57:36 +03:00
const createLinkMock = () => ({
setAttribute: jest.fn(),
click: jest.fn(),
style: {},
});
export const appendChild = jest.fn();
export const removeChild = jest.fn();
export const windowMock = fromPartial<Window>({
document: fromAny({
2021-09-19 11:57:36 +03:00
createElement: jest.fn(createLinkMock),
body: { appendChild, removeChild },
}),
2021-09-19 11:57:36 +03:00
});