修复不应该jest console导致的ci失败
This commit is contained in:
@@ -306,6 +306,8 @@ describe('EventSystem - 事件系统测试', () => {
|
||||
});
|
||||
|
||||
test('异步事件处理中的错误应该被正确处理', async () => {
|
||||
const consoleSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
|
||||
|
||||
let successHandlerCalled = false;
|
||||
|
||||
eventSystem.on('error:event', async () => {
|
||||
@@ -321,6 +323,8 @@ describe('EventSystem - 事件系统测试', () => {
|
||||
|
||||
// 成功的处理器应该被调用
|
||||
expect(successHandlerCalled).toBe(true);
|
||||
|
||||
consoleSpy.mockRestore();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -487,6 +491,8 @@ describe('EventSystem - 事件系统测试', () => {
|
||||
|
||||
describe('错误处理', () => {
|
||||
test('监听器中的错误不应该影响其他监听器', () => {
|
||||
const consoleSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
|
||||
|
||||
let successHandlerCalled = false;
|
||||
|
||||
eventSystem.on('error:event', () => {
|
||||
@@ -504,6 +510,8 @@ describe('EventSystem - 事件系统测试', () => {
|
||||
|
||||
// 成功的处理器应该被调用
|
||||
expect(successHandlerCalled).toBe(true);
|
||||
|
||||
consoleSpy.mockRestore();
|
||||
});
|
||||
|
||||
test('应该能够处理监听器注册和移除中的边界情况', () => {
|
||||
|
||||
@@ -507,6 +507,8 @@ describe('Scene - 场景管理系统测试', () => {
|
||||
});
|
||||
|
||||
test('系统处理过程中的异常应该被正确处理', () => {
|
||||
const consoleSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
|
||||
|
||||
class ErrorSystem extends EntitySystem {
|
||||
constructor() {
|
||||
super(Matcher.empty().all(PositionComponent));
|
||||
@@ -527,6 +529,8 @@ describe('Scene - 场景管理系统测试', () => {
|
||||
expect(() => {
|
||||
scene.update();
|
||||
}).not.toThrow();
|
||||
|
||||
consoleSpy.mockRestore();
|
||||
});
|
||||
|
||||
test('空场景的更新应该安全', () => {
|
||||
|
||||
Reference in New Issue
Block a user