Skip to content

Commit

Permalink
added time to afterAll test to avoide failing on timeouts
Browse files Browse the repository at this point in the history
  • Loading branch information
avifenesh committed Mar 6, 2024
1 parent 798d701 commit 3765a80
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions node/tests/RedisClient.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ describe("RedisClient", () => {
if (testsFailed === 0) {
await cluster.close();
}
});
}, 10000);

const getAddress = (port: number) => {
return [{ host: "localhost", port }];
};

const getOptions = (
port: number,
protocol: ProtocolVersion
protocol: ProtocolVersion,
): BaseClientConfiguration => {
return {
addresses: getAddress(port),
Expand Down Expand Up @@ -111,23 +111,23 @@ describe("RedisClient", () => {
"info without parameters",
async (protocol) => {
const client = await RedisClient.createClient(
getOptions(port, protocol)
getOptions(port, protocol),
);
const result = await client.info();
expect(result).toEqual(expect.stringContaining("# Server"));
expect(result).toEqual(expect.stringContaining("# Replication"));
expect(result).toEqual(
expect.not.stringContaining("# Latencystats")
expect.not.stringContaining("# Latencystats"),
);
client.close();
}
},
);

it.each([ProtocolVersion.RESP2, ProtocolVersion.RESP3])(
"simple select test",
async (protocol) => {
const client = await RedisClient.createClient(
getOptions(port, protocol)
getOptions(port, protocol),
);
let selectResult = await client.select(0);
expect(selectResult).toEqual("OK");
Expand All @@ -145,14 +145,14 @@ describe("RedisClient", () => {
expect(selectResult).toEqual("OK");
expect(await client.get(key)).toEqual(value);
client.close();
}
},
);

it.each([ProtocolVersion.RESP2, ProtocolVersion.RESP3])(
`can send transactions_%p`,
async (protocol) => {
const client = await RedisClient.createClient(
getOptions(port, protocol)
getOptions(port, protocol),
);
const transaction = new Transaction();
const expectedRes = transactionTest(transaction);
Expand All @@ -161,17 +161,17 @@ describe("RedisClient", () => {
expectedRes.push("OK");
expect(result).toEqual(expectedRes);
client.close();
}
},
);

it.each([ProtocolVersion.RESP2, ProtocolVersion.RESP3])(
"can return null on WATCH transaction failures",
async (protocol) => {
const client1 = await RedisClient.createClient(
getOptions(port, protocol)
getOptions(port, protocol),
);
const client2 = await RedisClient.createClient(
getOptions(port, protocol)
getOptions(port, protocol),
);
const transaction = new Transaction();
transaction.get("key");
Expand All @@ -186,7 +186,7 @@ describe("RedisClient", () => {

client1.close();
client2.close();
}
},
);

runBaseTests<Context>({
Expand Down

0 comments on commit 3765a80

Please sign in to comment.