Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const { getByText, container } = renderWithProvider(
{CHILDREN}
{CHILDREN}
{CHILDREN}
);
// ACT
fireEvent.click(getByText(HEADER_1));
fireEvent.click(getByText(HEADER_2));
fireEvent.click(getByText(HEADER_3));
// ASSERT
expect(container.querySelectorAll('.ant-collapse-header')[0].textContent).toEqual(HEADER_3);
expect(container.querySelectorAll('.ant-collapse-header')[1].textContent).toEqual(HEADER_2);
expect(container.querySelectorAll('.ant-collapse-header')[2].textContent).toEqual(HEADER_1);
});
});
function clickBooleanElement(element) {
if (element.disabled) return;
fireEvent.mouseOver(element);
fireEvent.mouseMove(element);
fireEvent.mouseDown(element);
fireEvent.focus(element);
fireEvent.mouseUp(element);
fireEvent.click(element);
}
function dblClickElement(element) {
fireEvent.mouseOver(element);
fireEvent.mouseMove(element);
fireEvent.mouseDown(element);
element.focus();
fireEvent.mouseUp(element);
fireEvent.click(element);
fireEvent.mouseDown(element);
fireEvent.mouseUp(element);
fireEvent.click(element);
fireEvent.dblClick(element);
const labelAncestor = findTagInParents(element, "LABEL");
labelAncestor && clickLabel(labelAncestor);
}
function clickElement(element) {
fireEvent.mouseOver(element);
fireEvent.mouseMove(element);
fireEvent.mouseDown(element);
element.focus();
fireEvent.mouseUp(element);
fireEvent.click(element);
const labelAncestor = findTagInParents(element, "LABEL");
labelAncestor && clickLabel(labelAncestor);
}
function clickLabel(label) {
fireEvent.mouseOver(label);
fireEvent.mouseMove(label);
fireEvent.mouseDown(label);
fireEvent.mouseUp(label);
if (label.htmlFor) {
const input = document.getElementById(label.htmlFor);
input.focus();
fireEvent.click(label);
} else {
const input = label.querySelector("input,textarea,select");
input.focus();
label.focus();
fireEvent.click(label);
}
}
it('should display an error if blocks is below 1', async () => {
const { input, btn, findByText } = renderComponent();
const numBlocks = -5;
fireEvent.change(input, { target: { value: numBlocks } });
fireEvent.click(btn);
expect(await findByText(/must be a positve number/)).toBeInTheDocument();
});
it('should deposit funds when the button is clicked', async () => {
const { input, btn, getByText } = renderComponent();
const amount = '250000';
fireEvent.change(input, { target: { value: amount } });
fireEvent.click(btn);
await waitForElement(() => getByText('Deposited 250,000 sats to alice'));
expect(lightningServiceMock.getNewAddress).toBeCalledTimes(1);
expect(bitcoindServiceMock.sendFunds).toBeCalledWith(
expect.anything(),
'bc1aaaa',
0.0025,
);
});
await wait(() => fireEvent.click(getByText('REST')));
expect(shell.openExternal).toBeCalledWith(
beforeEach(() => {
fireEvent.click(findAllProjectsRadio());
});