mirror of
https://github.com/fsolla/teqo.git
synced 2026-11-12 22:13:05 +00:00
fix(B55): defer share strategy to click + stabilize unit tests
This commit is contained in:
parent
b96bf190e8
commit
8ff9e20a88
4 changed files with 11 additions and 5 deletions
|
|
@ -71,6 +71,7 @@ export const E2E_AFFECTED_MANIFEST = [
|
|||
'src/utilities/homeSearch',
|
||||
'src/utilities/campaignDashboardData',
|
||||
'src/lib/campaignHomeSearchHits',
|
||||
'src/lib/homeSearchShare',
|
||||
],
|
||||
specs: ['campaignHomeActions'],
|
||||
},
|
||||
|
|
|
|||
|
|
@ -21,11 +21,10 @@ export const HomeSearchShareAction = ({
|
|||
title: string
|
||||
detailPath: string
|
||||
}) => {
|
||||
const strategy = resolveHomeSearchShareStrategy()
|
||||
|
||||
const handleShare = async () => {
|
||||
const absoluteUrl = buildHomeSearchDetailUrl(detailPath)
|
||||
const shareText = buildHomeSearchShareText(title, absoluteUrl)
|
||||
const strategy = resolveHomeSearchShareStrategy()
|
||||
|
||||
if (strategy === 'native') {
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,9 @@ export const buildWhatsAppTextShareUrl = (message: string): string => {
|
|||
}
|
||||
|
||||
const canUseNativeWebShare = (): boolean =>
|
||||
typeof navigator !== 'undefined' && typeof navigator.share === 'function'
|
||||
typeof window !== 'undefined' &&
|
||||
typeof navigator !== 'undefined' &&
|
||||
typeof navigator.share === 'function'
|
||||
|
||||
export type HomeSearchShareStrategy = 'native' | 'whatsapp'
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,14 @@
|
|||
import { fireEvent, render, screen } from '@testing-library/react'
|
||||
import { describe, expect, it, vi } from 'vitest'
|
||||
import { cleanup, fireEvent, render, screen } from '@testing-library/react'
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest'
|
||||
|
||||
import { HomeSearchHitRow } from '@/components/campaign/dashboard/HomeSearchHitRow'
|
||||
import { HomeSearchShareAction } from '@/components/campaign/dashboard/HomeSearchShareAction'
|
||||
import { HomeSearchWhatsAppAction } from '@/components/campaign/dashboard/HomeSearchWhatsAppAction'
|
||||
|
||||
afterEach(() => {
|
||||
cleanup()
|
||||
})
|
||||
|
||||
describe('HomeSearchWhatsAppAction', () => {
|
||||
it('renders WhatsApp link when phone normalizes', () => {
|
||||
render(<HomeSearchWhatsAppAction phone="71999998888" contactName="Maria Silva" />)
|
||||
|
|
|
|||
Loading…
Reference in a new issue