SupportForm.utils.test.ts 796 B

123456789101112131415161718192021222324
  1. import { describe, expect, it } from 'vitest'
  2. import { createSupportFormUrl } from './SupportForm.utils'
  3. describe('createSupportFormUrl', () => {
  4. it('returns base URL with no params', () => {
  5. expect(createSupportFormUrl({})).toBe('/support/new')
  6. })
  7. it('does not append a bare ? when params are empty', () => {
  8. expect(createSupportFormUrl({})).not.toContain('?')
  9. })
  10. it('includes provided params in the query string', () => {
  11. const url = createSupportFormUrl({ projectRef: 'my-project' })
  12. expect(url).toContain('projectRef=my-project')
  13. })
  14. it('includes multiple params', () => {
  15. const url = createSupportFormUrl({ projectRef: 'my-project', subject: 'help' })
  16. expect(url).toContain('projectRef=my-project')
  17. expect(url).toContain('subject=help')
  18. })
  19. })