Files
admin 0593ff7e62
nginx serve /uploads direct (audio speed) / patch-nginx (push) Failing after 1m34s
数字我 Digital Me:全量入库(大文件走 Git LFS)
2026-10-10 16:24:43 +08:00

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');
});