MCPcopy
hub / github.com/redis/node-redis / setup

Function setup

packages/client/lib/client/index.spec.ts:1483–1510  ·  view source on GitHub ↗
(
      socketOptions: Partial<RedisSocketOptions>,
      dropCount: number,
    )

Source from the content-addressed store, hash-verified

1481 });
1482
1483 async function setup(
1484 socketOptions: Partial<RedisSocketOptions>,
1485 dropCount: number,
1486 ) {
1487 const port = await getFreePortNumber();
1488 const server = setupMockServer(dropCount);
1489 const options = {
1490 ...{
1491 socket: {
1492 host: "localhost",
1493 port,
1494 },
1495 ...socketOptions,
1496 },
1497 };
1498 const client = createClient(options);
1499 const log = setupLog(client);
1500 await once(server.listen(port), "listening");
1501 return {
1502 log,
1503 client,
1504 server,
1505 teardown: async function () {
1506 client.destroy();
1507 server.close();
1508 },
1509 };
1510 }
1511
1512 function setupLog(client: EventEmitter): string[] {
1513 const log: string[] = [];

Callers 1

index.spec.tsFile · 0.70

Calls 6

getFreePortNumberFunction · 0.90
setupMockServerFunction · 0.85
createClientFunction · 0.85
setupLogFunction · 0.85
destroyMethod · 0.65
closeMethod · 0.45

Tested by

no test coverage detected