Analyzer mock: flags `a@b.com` as EMAIL_ADDRESS when that entity is in scope.
(text: string, entities: string[] | undefined)
| 22 | |
| 23 | /** Analyzer mock: flags `a@b.com` as EMAIL_ADDRESS when that entity is in scope. */ |
| 24 | function emailSpans(text: string, entities: string[] | undefined): Span[] { |
| 25 | if (entities && !entities.includes('EMAIL_ADDRESS')) return [] |
| 26 | const idx = text.indexOf('a@b.com') |
| 27 | return idx === -1 ? [] : [{ entity_type: 'EMAIL_ADDRESS', start: idx, end: idx + 7, score: 0.9 }] |
| 28 | } |
| 29 | |
| 30 | describe('validate_pii (Presidio service)', () => { |
| 31 | let analyzeBodies: Array<{ text: string; language: string; entities?: string[] }> |