Skip to content

Commit

Permalink
adjusting tests
Browse files Browse the repository at this point in the history
  • Loading branch information
holtgrewe committed Sep 27, 2023
1 parent b7935ae commit 8a5d577
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions frontend/src/api/__tests__/common.spec.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,29 @@
import { describe, it, expect } from 'vitest'

import { API_BASE_PREFIX, API_BASE_PREFIX_ANNONARS, API_BASE_PREFIX_MEHARI } from '../common'
import { API_BASE_PREFIX, API_BASE_PREFIX_ANNONARS, API_BASE_PREFIX_MEHARI, API_BASE_PREFIX_NGINX } from '../common'

describe.concurrent('API_BASE_PREFIX constants', () => {
it('returns the correct API base prefix in production mode', () => {
const originalMode = import.meta.env.MODE
expect(API_BASE_PREFIX).toBe('/')
expect(API_BASE_PREFIX).toBe('/internal/')
import.meta.env.MODE = originalMode
})

it('returns the correct API base prefix for annonars in production mode', () => {
const originalMode = import.meta.env.MODE
expect(API_BASE_PREFIX_ANNONARS).toBe('/proxy/annonars')
expect(API_BASE_PREFIX_ANNONARS).toBe('/internal/proxy/annonars')
import.meta.env.MODE = originalMode
})

it('returns the correct API base prefix for mehari in production mode', () => {
const originalMode = import.meta.env.MODE
expect(API_BASE_PREFIX_MEHARI).toBe('/proxy/mehari')
expect(API_BASE_PREFIX_MEHARI).toBe('/internal/proxy/mehari')
import.meta.env.MODE = originalMode
})

it('returns the correct API base prefix for nginx in production mode', () => {
const originalMode = import.meta.env.MODE
expect(API_BASE_PREFIX_NGINX).toBe('/internal/proxy/nginx')
import.meta.env.MODE = originalMode
})
})

0 comments on commit 8a5d577

Please sign in to comment.