SupportForm.utils.test.ts24 lines · main
1import { describe, expect, it } from 'vitest'
2
3import { createSupportFormUrl } from './SupportForm.utils'
4
5describe('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})