import { hasJustConnected, landingPageLink } from '../pluginPage' jest.mock( '@woocommerce/settings', () => ({ getAdminLink: (path: string) => `/wp-admin/${path}` }), { virtual: true } ) describe('pluginPage', () => { it('links to the landing page', () => { expect(landingPageLink({ justConnected: false })).toBe( '/wp-admin/admin.php?page=wc-admin&path=/posten-bring-checkout' ) }) it('tells the landing page the shop has just been connected', () => { const link = landingPageLink({ justConnected: true }) expect(hasJustConnected(new URL(link, 'https://shop.example').search)).toBe( true ) }) it('does not take an arrival without the mark as just connected', () => { expect(hasJustConnected('?page=wc-admin&path=/posten-bring-checkout')).toBe( false ) }) })