Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

1.1 KB
Raw Blame
import { generateMailToLink, mailToSupport } from '../util'

describe('generateMailToLink', () => {
  it('should return mailto link with email only when no subject or body provided', () => {
    const result = generateMailToLink('[email protected]')

    expect(result).toBe('mailto:[email protected]')
  })
})

describe('mailToSupport', () => {
  it('encodes support context without allowing it to introduce extra query parameters', () => {
    const result = mailToSupport('[email protected]', 'Pro & Team', '1.0.0')

    expect(result.startsWith('mailto:[email protected]?')).toBe(true)

    const query = result.split('?')[1]
    expect(query).toBeDefined()

    const params = new URLSearchParams(query)
    expect(params.get('subject')).toBe('Technical Support Request Pro & Team [email protected]')

    const body = params.get('body')
    expect(body).toContain('Current Plan: Pro & Team')
    expect(body).toContain('Account: [email protected]')
    expect(body).toContain('Version: 1.0.0')
    expect([...params.keys()]).toEqual(['subject', 'body'])
  })
})