refactor(core): 统一参数命名 - worldId/sceneId 改为 worldName/sceneName (#225)
* refactor(core): 统一参数命名 - worldId/sceneId 改为 worldName/sceneName * test(core): 更新测试用例以匹配新的错误消息 * refactor(core): 提高代码覆盖率 - 添加参数验证和测试
This commit is contained in:
@@ -109,12 +109,22 @@ describe('WorldManager', () => {
|
||||
expect(world.name).toBe('configured-world');
|
||||
});
|
||||
|
||||
test('空的World name应该抛出错误', () => {
|
||||
expect(() => {
|
||||
worldManager.createWorld('');
|
||||
}).toThrow('World name不能为空');
|
||||
|
||||
expect(() => {
|
||||
worldManager.createWorld(' ');
|
||||
}).toThrow('World name不能为空');
|
||||
});
|
||||
|
||||
test('重复的World ID应该抛出错误', () => {
|
||||
worldManager.createWorld('duplicate-world');
|
||||
|
||||
expect(() => {
|
||||
worldManager.createWorld('duplicate-world');
|
||||
}).toThrow("World ID 'duplicate-world' 已存在");
|
||||
}).toThrow("World name 'duplicate-world' 已存在");
|
||||
});
|
||||
|
||||
test('超出最大World数量应该抛出错误', () => {
|
||||
|
||||
Reference in New Issue
Block a user