fix(config): resolve remote hierarchy in memory for every profile

This commit is contained in:
2026-09-05 21:21:24 +08:00
parent 62328b6fd6
commit 053302c5df
27 changed files with 286 additions and 143 deletions
@@ -8,7 +8,7 @@ test('HttpConfigFetcher:POST 空 body,并无条件以 ? 拼接 cache bust',
const calls: Array<{ input: string; init?: RequestInit }> = [];
const fetcher = new HttpConfigFetcher(async (input, init) => {
calls.push({ input: String(input), init });
return new Response('{"data":{"urlserver":"10.0.0.1:3088"}}');
return new Response('{"player_server_tcp":"10.0.0.1:3088"}');
});
await fetcher.fetch('https://config.example/file.txt?existing=1', () => '123');
@@ -22,7 +22,7 @@ test('resolveRuntimeConfig:把 cacheBust 注入唯一的 HTTP 请求构造点'
const calls: Array<{ input: string; init?: RequestInit }> = [];
const fetcher = new HttpConfigFetcher(async (input, init) => {
calls.push({ input: String(input), init });
return new Response('{"data":{"urlserver":"10.0.0.1:3088"}}');
return new Response('{"player_server_tcp":"10.0.0.1:3088"}');
});
await resolveRuntimeConfig({
@@ -49,7 +49,7 @@ test('HttpConfigFetcher:非法 JSON 显式抛 ConfigParseError', async () => {
test('HttpConfigFetcher:非 200 响应即使 body 是合法 JSON 也拒绝', async () => {
const fetcher = new HttpConfigFetcher(async () => new Response(
'{"data":{"urlserver":"10.0.0.1:3088"}}',
'{"player_server_tcp":"10.0.0.1:3088"}',
{ status: 503 },
));
await assert.rejects(