Files
explorer-monorepo/frontend/libs/frontend-api-client/api-base.test.ts
defiQUG 4b747f0309 feat(explorer): dynamic feeds, wallet SSR alignment, and detail pagination
Align wallet SSR with report token-list, dedupe featured v1 tokens, refresh home and wallet snapshots on a 60s cadence, and drive vanilla SPA chain add/watch from API metadata. Add shared pagination/tabs for address, token, and transaction pages, extend token aggregation helpers, and harden stats API with tests and health checks.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-22 17:58:27 -07:00

41 lines
1.2 KiB
TypeScript

import { describe, expect, it } from 'vitest'
import { resolveExplorerApiBase } from './api-base'
describe('resolveExplorerApiBase', () => {
it('prefers an explicit env value when present', () => {
expect(
resolveExplorerApiBase({
envValue: 'https://blockscout.defi-oracle.io/',
browserOrigin: 'http://127.0.0.1:3000',
})
).toBe('https://blockscout.defi-oracle.io')
})
it('uses browser HTTPS origin when an explicit same-host HTTP value is present', () => {
expect(
resolveExplorerApiBase({
envValue: 'http://explorer.d-bis.org',
browserOrigin: 'https://explorer.d-bis.org',
})
).toBe('https://explorer.d-bis.org')
})
it('falls back to same-origin in the browser when env is empty', () => {
expect(
resolveExplorerApiBase({
envValue: '',
browserOrigin: 'http://127.0.0.1:3000/',
})
).toBe('http://127.0.0.1:3000')
})
it('falls back to the local backend on the server when no other base is available', () => {
expect(
resolveExplorerApiBase({
envValue: '',
browserOrigin: '',
})
).toBe('http://localhost:8080')
})
})