Files
youle_cocos/cocoscreator_projects/framework-tests/config/profiles.test.ts
T
2026-06-28 16:38:44 +08:00

28 lines
967 B
TypeScript

import { test } from 'node:test';
import assert from 'node:assert/strict';
import { resolveActiveProfile, PROFILES, ACTIVE_PROFILE } from '../../YouleNexus/assets/framework/config/profiles.ts';
test('默认返回 ACTIVE_PROFILE', () => {
const p = resolveActiveProfile('');
assert.equal(p.name, ACTIVE_PROFILE);
});
test('prod profile 无调试覆盖、isDebugger=false', () => {
const prod = PROFILES['prod'];
assert.equal(prod.isDebugger, false);
assert.equal(prod.server, undefined);
assert.equal(prod.identity, undefined);
assert.ok(prod.gameserver && prod.gameserver.length > 0);
});
test('?profile=local 切到 local,含调试服地址', () => {
const p = resolveActiveProfile('?profile=local');
assert.equal(p.name, 'local');
assert.ok(p.server && p.server.startsWith('ws://'));
});
test('未知 profile 回退到 ACTIVE_PROFILE', () => {
const p = resolveActiveProfile('?profile=nope');
assert.equal(p.name, ACTIVE_PROFILE);
});