feat(framework): server testing utils, transaction storage simplify, pathfinding tests (#384)

## Server Testing Utils
- Add TestServer, TestClient, MockRoom for unit testing
- Export testing utilities from @esengine/server/testing

## Transaction Storage (BREAKING)
- Simplify RedisStorage/MongoStorage to factory pattern only
- Remove DI client injection option
- Add lazy connection and Symbol.asyncDispose support
- Add 161 unit tests with full coverage

## Pathfinding Tests
- Add 150 unit tests covering all components
- BinaryHeap, Heuristics, AStarPathfinder, GridMap, NavMesh, PathSmoother

## Docs
- Update storage.md for new factory pattern API
This commit is contained in:
YHH
2025-12-29 15:02:13 +08:00
committed by GitHub
parent 10c3891abd
commit 3b978384c7
50 changed files with 7591 additions and 660 deletions

View File

@@ -55,18 +55,18 @@ export type {
TransactionManagerConfig,
ITransactionStorage,
ITransactionOperation,
ITransactionContext,
} from './core/types.js'
ITransactionContext
} from './core/types.js';
export {
TransactionContext,
createTransactionContext,
} from './core/TransactionContext.js'
createTransactionContext
} from './core/TransactionContext.js';
export {
TransactionManager,
createTransactionManager,
} from './core/TransactionManager.js'
createTransactionManager
} from './core/TransactionManager.js';
// =============================================================================
// Storage | 存储
@@ -75,29 +75,29 @@ export {
export {
MemoryStorage,
createMemoryStorage,
type MemoryStorageConfig,
} from './storage/MemoryStorage.js'
type MemoryStorageConfig
} from './storage/MemoryStorage.js';
export {
RedisStorage,
createRedisStorage,
type RedisStorageConfig,
type RedisClient,
} from './storage/RedisStorage.js'
type RedisClient
} from './storage/RedisStorage.js';
export {
MongoStorage,
createMongoStorage,
type MongoStorageConfig,
type MongoDb,
type MongoCollection,
} from './storage/MongoStorage.js'
type MongoCollection
} from './storage/MongoStorage.js';
// =============================================================================
// Operations | 操作
// =============================================================================
export { BaseOperation } from './operations/BaseOperation.js'
export { BaseOperation } from './operations/BaseOperation.js';
export {
CurrencyOperation,
@@ -105,8 +105,8 @@ export {
type CurrencyOperationType,
type CurrencyOperationData,
type CurrencyOperationResult,
type ICurrencyProvider,
} from './operations/CurrencyOperation.js'
type ICurrencyProvider
} from './operations/CurrencyOperation.js';
export {
InventoryOperation,
@@ -115,8 +115,8 @@ export {
type InventoryOperationData,
type InventoryOperationResult,
type IInventoryProvider,
type ItemData,
} from './operations/InventoryOperation.js'
type ItemData
} from './operations/InventoryOperation.js';
export {
TradeOperation,
@@ -126,8 +126,8 @@ export {
type TradeItem,
type TradeCurrency,
type TradeParty,
type ITradeProvider,
} from './operations/TradeOperation.js'
type ITradeProvider
} from './operations/TradeOperation.js';
// =============================================================================
// Distributed | 分布式
@@ -141,8 +141,8 @@ export {
type SagaStepState,
type SagaStepLog,
type SagaLog,
type SagaResult,
} from './distributed/SagaOrchestrator.js'
type SagaResult
} from './distributed/SagaOrchestrator.js';
// =============================================================================
// Integration | 集成
@@ -152,8 +152,8 @@ export {
withTransactions,
TransactionRoom,
type TransactionRoomConfig,
type ITransactionRoom,
} from './integration/RoomTransactionMixin.js'
type ITransactionRoom
} from './integration/RoomTransactionMixin.js';
// =============================================================================
// Tokens | 令牌
@@ -161,5 +161,5 @@ export {
export {
TransactionManagerToken,
TransactionStorageToken,
} from './tokens.js'
TransactionStorageToken
} from './tokens.js';