refactor(WebSocketManager): passing in strategy (#9122)

* refactor(WebSocketManager): passing in strategy

* chore: update tests

* chore: requested nits

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
DD
2023-02-19 20:57:31 +02:00
committed by GitHub
parent c6f9c50ba9
commit 5c5a5832b9
5 changed files with 39 additions and 26 deletions

View File

@@ -163,6 +163,7 @@ test('spawn, connect, send a message, session info, and destroy', async () => {
shardIds: [0, 1],
retrieveSessionInfo: mockRetrieveSessionInfo,
updateSessionInfo: mockUpdateSessionInfo,
buildStrategy: (manager) => new WorkerShardingStrategy(manager, { shardsPerWorker: 'all' }),
});
const managerEmitSpy = vi.spyOn(manager, 'emit');
@@ -191,9 +192,6 @@ test('spawn, connect, send a message, session info, and destroy', async () => {
},
}));
const strategy = new WorkerShardingStrategy(manager, { shardsPerWorker: 'all' });
manager.setStrategy(strategy);
await manager.connect();
expect(mockConstructor).toHaveBeenCalledWith(
expect.stringContaining('defaultWorker.js'),