fix: update API URLs and improve error handling for SUB2API configuration

This commit is contained in:
QLHazyCoder
2026-05-08 09:11:19 +08:00
parent 144b144042
commit 6f9a9913b5
12 changed files with 62 additions and 16 deletions
@@ -71,6 +71,20 @@ test('navigation utils support codex2api mode and url normalization', () => {
assert.equal(utils.getPanelModeLabel('codex2api'), 'Codex2API');
});
test('navigation utils leaves SUB2API url empty when no default is configured', () => {
const source = fs.readFileSync('background/navigation-utils.js', 'utf8');
const globalScope = {};
const api = new Function('self', `${source}; return self.MultiPageBackgroundNavigationUtils;`)(globalScope);
const utils = api.createNavigationUtils({
DEFAULT_CODEX2API_URL: 'http://localhost:8080/admin/accounts',
DEFAULT_SUB2API_URL: '',
normalizeLocalCpaStep9Mode: (value) => value,
});
assert.equal(utils.normalizeSub2ApiUrl(''), '');
});
test('navigation utils recognize the iCloud mail tab family on both supported hosts', () => {
const source = fs.readFileSync('background/navigation-utils.js', 'utf8');
const globalScope = {};