Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function fireEvent(...args) {
dtlFireEvent(...args)
await wait()
}
const fireEvent = async (...args) => {
const event = dtlFireEvent(...args)
await tick()
return event
}
preactAct(() => {
returnValue = dtl.fireEvent(...args)
})
act(() => {
returnValue = dtlFireEvent(...args)
})
return returnValue
it('shows links when override is clicked', async () => {
expect(findLinksInner().exists()).toBe(false);
fireEvent(findShowAnyways(), new MouseEvent('click', { bubbles: true }));
await wrapper.vm.$nextTick();
expect(findLinksInner().exists()).toBe(true);
});
});
it('should allow dragging a node', async () => {
const { getByText } = renderComponent();
const lnd = getByText(`LND v${LndVersion.latest}`);
const setData = jest.fn();
const dragEvent = createEvent.dragStart(lnd);
Object.defineProperty(dragEvent, 'dataTransfer', { value: { setData } });
fireEvent(lnd, dragEvent);
expect(setData).toBeCalledWith(
REACT_FLOW_CHART,
JSON.stringify({ type: 'lnd', version: LndVersion.latest }),
);
});
syntheticEvents.forEach(syntheticEvent => fireEvent(element, syntheticEvent));