18 lines
725 B
TypeScript
18 lines
725 B
TypeScript
import test from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
|
|
import { resolveApiBase } from '../src/lib/apiBase.ts';
|
|
|
|
test('Docker same-origin sentinel uses the current Nginx origin', () => {
|
|
assert.equal(resolveApiBase('same-origin', '127.0.0.1'), '');
|
|
});
|
|
|
|
test('an explicit API URL wins over hostname defaults', () => {
|
|
assert.equal(resolveApiBase('https://api.example.test', 'digitalme.invoratec.cn'), 'https://api.example.test');
|
|
});
|
|
|
|
test('unset API URL keeps production and local development defaults', () => {
|
|
assert.equal(resolveApiBase(undefined, 'digitalme.invoratec.cn'), 'https://digitalme-api.invoratec.cn');
|
|
assert.equal(resolveApiBase(undefined, 'localhost'), 'http://localhost:3701');
|
|
});
|