The line to test is
<ButtonCTA text="Facebook" type="submit" onClick={() => {
window.open('https://www.facebook.com/sharer/sharer.php?u=https://www.legalzoom.com', '', 'status=1,width=575,height=520'); }}
className="btn btn-action tw-block tw-py-0 tw-px-3 tw-flex tw-items-center
tw-flex-row-reverse tw-text-16 tw-leading-6 tw-tracking-[-0.2px] tw-w-[192px]
tw-justify-center tw-mr-3" testid='Facebook'>
</ButtonCTA>
const button = getByTestId(containerNode,'Facebook');
userEvent.click(button);
const url='https://www.facebook.com/sharer/sharer.php?u=https://www.legalzoom.com';
expect(window.location.href).toMatch(url);
In jest it navigates to Localhost so this code is not working.