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