diff --git a/packages/core/server/src/__tests__/sync-message-manager.test.ts b/packages/core/server/src/__tests__/sync-message-manager.test.ts index 31a35921c1..0fef6d7afd 100644 --- a/packages/core/server/src/__tests__/sync-message-manager.test.ts +++ b/packages/core/server/src/__tests__/sync-message-manager.test.ts @@ -13,7 +13,7 @@ import { createMockCluster, sleep } from '@nocobase/test'; describe('sync-message-manager', () => { test('subscribe + publish', async () => { const cluster = await createMockCluster(); - const [node1, node2] = cluster.instances; + const [node1, node2] = cluster.nodes; const mockListener = vi.fn(); await node1.syncMessageManager.subscribe('test1', mockListener); await node2.syncMessageManager.subscribe('test1', mockListener); @@ -26,7 +26,7 @@ describe('sync-message-manager', () => { test('transaction', async () => { const cluster = await createMockCluster(); - const [node1, node2] = cluster.instances; + const [node1, node2] = cluster.nodes; const mockListener = vi.fn(); await node1.syncMessageManager.subscribe('test1', mockListener); const transaction = await node2.db.sequelize.transaction(); @@ -54,7 +54,7 @@ describe('sync-message-manager', () => { const cluster = await createMockCluster({ plugins: [MyPlugin], }); - const [app1, app2] = cluster.instances; + const [app1, app2] = cluster.nodes; await app1.pm.get(MyPlugin).sendSyncMessage('message1'); expect(mockListener).toBeCalledTimes(1); expect(mockListener).toHaveBeenCalledWith('message1'); @@ -77,7 +77,7 @@ describe('sync-message-manager', () => { const cluster = await createMockCluster({ plugins: [MyPlugin], }); - const [app1, app2] = cluster.instances; + const [app1, app2] = cluster.nodes; const transaction = await app1.db.sequelize.transaction(); app1.pm.get(MyPlugin).sendSyncMessage('message1', { transaction }); await sleep(1000); diff --git a/packages/core/test/src/server/mock-server.ts b/packages/core/test/src/server/mock-server.ts index 244c135aab..fd563f50a0 100644 --- a/packages/core/test/src/server/mock-server.ts +++ b/packages/core/test/src/server/mock-server.ts @@ -269,7 +269,7 @@ export async function createMockCluster( skipStart?: boolean; } = {}, ) { - const instances: MockServer[] = []; + const nodes: MockServer[] = []; const clusterName = options.name || `cluster_${uid()}`; const appName = options.appName || `app_${uid()}`; for (const i of _.range(0, options.number || 2)) { @@ -281,13 +281,13 @@ export async function createMockCluster( channelPrefix: clusterName, }, }); - instances.push(app); + nodes.push(app); } return { - instances, + nodes, async destroy() { - for (const instance of instances) { - await instance.destroy(); + for (const node of nodes) { + await node.destroy(); } }, };