Files
wehub-resource-sync d25d482dc2
Publish CLI Package / publish-npm (push) Waiting to run
Publish Python SDK / publish-pypi (push) Waiting to run
Publish TypeScript SDK / publish-npm (push) Waiting to run
CI / Migrate Dev DB (push) Has been skipped
CI / Detect Version (push) Has been cancelled
CI / Migrate DB (push) Has been cancelled
CI / Build Dev ECR (./docker/app.Dockerfile, ECR_APP) (push) Has been cancelled
CI / Build Dev ECR (./docker/db.Dockerfile, ECR_MIGRATIONS) (push) Has been cancelled
CI / Build Dev ECR (./docker/pii.Dockerfile, ECR_PII) (push) Has been cancelled
CI / Build Dev ECR (./docker/realtime.Dockerfile, ECR_REALTIME) (push) Has been cancelled
CI / Deploy Trigger.dev (Dev) (push) Has been cancelled
CI / Build AMD64 (./docker/app.Dockerfile, ECR_APP, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build AMD64 (./docker/db.Dockerfile, ECR_MIGRATIONS, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build AMD64 (./docker/pii.Dockerfile, ECR_PII, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build AMD64 (./docker/realtime.Dockerfile, ECR_REALTIME, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/app.Dockerfile, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/db.Dockerfile, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/pii.Dockerfile, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/realtime.Dockerfile, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Check Docs Changes (push) Has been cancelled
CI / Process Docs (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / Test and Build (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:20:55 +08:00

105 lines
3.8 KiB
TypeScript

/**
* @vitest-environment node
*/
import { describe, expect, it } from 'vitest'
import { phoneNumberEnrichment } from '@/enrichments/phone-number/phone-number'
import type { EnrichmentProvider } from '@/enrichments/types'
function provider(id: string): EnrichmentProvider {
const p = phoneNumberEnrichment.providers.find((x) => x.id === id)
if (!p) throw new Error(`Provider ${id} not found in phone-number cascade`)
return p
}
const nameDomain = { fullName: 'John Doe', companyDomain: 'https://www.acme.com/careers' }
const linkedinOnly = { fullName: 'John Doe', linkedinUrl: 'https://linkedin.com/in/johndoe' }
describe('phone-number enrichment cascade', () => {
it('chains PDL then the phone-capable hosted providers', () => {
expect(phoneNumberEnrichment.providers.map((p) => p.id)).toEqual([
'pdl',
'wiza',
'findymail',
'prospeo',
'leadmagic',
'datagma',
])
})
describe('wiza (opportunistic)', () => {
const p = provider('wiza')
it('reveals phone, using name+domain or LinkedIn profile_url', () => {
expect(p.toolId).toBe('wiza_individual_reveal')
expect(p.buildParams(nameDomain)).toEqual({
full_name: 'John Doe',
domain: 'acme.com',
enrichment_level: 'phone',
})
expect(p.buildParams(linkedinOnly)).toEqual({
full_name: 'John Doe',
profile_url: 'https://linkedin.com/in/johndoe',
enrichment_level: 'phone',
})
expect(p.buildParams({ fullName: 'John Doe' })).toBeNull()
expect(p.mapOutput({ mobile_phone: '+1555', phones: [] })).toEqual({ phone: '+1555' })
expect(p.mapOutput({ phones: [{ number: '+1777' }] })).toEqual({ phone: '+1777' })
})
})
describe('findymail', () => {
const p = provider('findymail')
it('keys off the LinkedIn URL and skips without one', () => {
expect(p.toolId).toBe('findymail_find_phone')
expect(p.buildParams(linkedinOnly)).toEqual({
linkedin_url: 'https://linkedin.com/in/johndoe',
})
expect(p.buildParams(nameDomain)).toBeNull()
expect(p.mapOutput({ phone: '+1555' })).toEqual({ phone: '+1555' })
expect(p.mapOutput({ phone: null })).toBeNull()
})
})
describe('prospeo (opportunistic)', () => {
const p = provider('prospeo')
it('requests mobile enrichment via name+domain or LinkedIn', () => {
expect(p.toolId).toBe('prospeo_enrich_person')
expect(p.buildParams(nameDomain)).toEqual({
full_name: 'John Doe',
company_website: 'acme.com',
enrich_mobile: true,
})
expect(p.buildParams(linkedinOnly)).toEqual({
full_name: 'John Doe',
linkedin_url: 'https://linkedin.com/in/johndoe',
enrich_mobile: true,
})
expect(p.buildParams({ fullName: 'John Doe' })).toBeNull()
expect(p.mapOutput({ person: { mobile: { mobile: '+1555' } } })).toEqual({ phone: '+1555' })
})
})
describe('leadmagic', () => {
const p = provider('leadmagic')
it('keys off the LinkedIn URL and skips without one', () => {
expect(p.toolId).toBe('leadmagic_find_mobile')
expect(p.buildParams(linkedinOnly)).toEqual({
profile_url: 'https://linkedin.com/in/johndoe',
})
expect(p.buildParams(nameDomain)).toBeNull()
expect(p.mapOutput({ mobile_number: '+1555' })).toEqual({ phone: '+1555' })
expect(p.mapOutput({ mobile_number: null })).toBeNull()
})
})
describe('datagma', () => {
const p = provider('datagma')
it('passes the LinkedIn URL as username and skips without one', () => {
expect(p.toolId).toBe('datagma_find_phone')
expect(p.buildParams(linkedinOnly)).toEqual({ username: 'https://linkedin.com/in/johndoe' })
expect(p.buildParams(nameDomain)).toBeNull()
expect(p.mapOutput({ phone: '+1555' })).toEqual({ phone: '+1555' })
expect(p.mapOutput({ phone: null })).toBeNull()
})
})
})