useBaseUrl.spec.ts 827 B

1234567891011121314151617181920212223242526272829
  1. // Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. import { mockApplicationConfig } from '#tests/support/mock-applicationConfig.ts'
  3. import { useBaseUrl } from '../useBaseUrl.ts'
  4. describe('useBaseUrl', () => {
  5. it('returns configured base URL', () => {
  6. mockApplicationConfig({ http_type: 'https', fqdn: 'zammad.org' })
  7. const { baseUrl } = useBaseUrl()
  8. expect(baseUrl.value).toBe('https://zammad.org')
  9. })
  10. it('returns current base URL (zammad.example.com)', () => {
  11. mockApplicationConfig({ fqdn: 'zammad.example.com' })
  12. const { baseUrl } = useBaseUrl()
  13. expect(baseUrl.value).toBe('http://localhost:3000')
  14. })
  15. it('returns current base URL (empty FQDN)', () => {
  16. const { baseUrl } = useBaseUrl()
  17. expect(baseUrl.value).toBe('http://localhost:3000')
  18. })
  19. })