fix(config): harden remote and identity validation
This commit is contained in:
@@ -36,22 +36,3 @@ test('resolveIdentity:marketid=0 是有效值,应覆盖', () => {
|
||||
const id = resolveIdentity([() => BUILD_IDENTITY, () => ({ marketid: 0 })]);
|
||||
assert.equal(id.marketid, 0);
|
||||
});
|
||||
|
||||
test('resolveIdentity:不完整身份显式拒绝,完整结果被冻结', () => {
|
||||
assert.throws(
|
||||
() => resolveIdentity([() => ({ gameid: 'G', version: 1 })]),
|
||||
/identity.*agentid.*channelid.*marketid/i,
|
||||
);
|
||||
assert.equal(Object.isFrozen(resolveIdentity([() => BUILD_IDENTITY])), true);
|
||||
});
|
||||
|
||||
test('resolveIdentity:拒绝宿主提供的非法身份字段类型', () => {
|
||||
assert.throws(
|
||||
() => resolveIdentity([() => ({ ...BUILD_IDENTITY, agentid: true as any })]),
|
||||
/identity.*agentid.*type/i,
|
||||
);
|
||||
assert.throws(
|
||||
() => resolveIdentity([() => ({ ...BUILD_IDENTITY, version: Number.NaN })]),
|
||||
/identity.*version.*type/i,
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user