Files
youle_cocos/cocoscreator_projects/framework-tests/config/launch-wait-time.test.ts
T

19 lines
1.1 KiB
TypeScript

import test from 'node:test';
import assert from 'node:assert/strict';
import * as config from '../../YouleNexus/assets/framework/config/remote-config.ts';
import { BUILD_IDENTITY } from '../../YouleNexus/assets/framework/config/sources/defaults.ts';
test('launchWaitTime follows legacy default, hall own field and truthy hierarchy precedence', () => {
const resolve = (config as any).resolveLaunchWaitTime;
assert.equal(typeof resolve, 'function');
for (const [raw, expected] of [
[{}, 10], [{ hall_config: { launchWaitTime: 0 } }, 0],
[{ hall_config: { launchWaitTime: 4000 }, launchWaitTime: 0 }, 4000],
[{ hall_config: { launchWaitTime: 4000 }, launchWaitTime: 2500 }, 2500],
[{ launchWaitTime: 2500, agentlist: [{ agentid: BUILD_IDENTITY.agentid, launchWaitTime: 3200 }] }, 3200],
] as const) assert.equal(resolve(config.createRemoteConfig(raw, BUILD_IDENTITY)), expected);
for (const value of [-1, Infinity, NaN, '5000', false, null, undefined]) {
assert.throws(() => resolve(config.createRemoteConfig({ hall_config: { launchWaitTime: value } }, BUILD_IDENTITY)), /launchWaitTime/);
}
});