Skip to content
2 changes: 1 addition & 1 deletion pkg/commands/bitcount.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe("when key is set", () => {
expect(res).toEqual(43);
});

test("with start and end", () => {
describe("with start and end", () => {
test("returns bitcount", async () => {
const key = newKey();
const value = "Hello World";
Expand Down
2 changes: 1 addition & 1 deletion pkg/commands/exec.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const { newKey, cleanup } = keygen();
afterAll(cleanup);

describe("ExecCommand", () => {
test("basic string operations", () => {
describe("basic string operations", () => {
test("GET and SET", async () => {
const key = newKey();
const value = randomID();
Expand Down
4 changes: 2 additions & 2 deletions pkg/commands/hgetall.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { afterAll, expect, test } from "bun:test";
import { afterAll, expect, test, describe } from "bun:test";
import { keygen, newHttpClient, randomID, randomUnsafeIntegerString } from "../test-utils";
import { HGetAllCommand } from "./hgetall";
import { HSetCommand } from "./hset";
Expand All @@ -20,7 +20,7 @@ test("returns all fields", async () => {
const obj = { [field1]: value1, [field2]: value2 };
expect(res).toEqual(obj);
});
test("when hash does not exist", () => {
describe("when hash does not exist", () => {
test("it returns null", async () => {
const res = await new HGetAllCommand([randomID()]).exec(client);
expect(res).toEqual(null);
Expand Down
4 changes: 2 additions & 2 deletions pkg/commands/hincrbyfloat.test.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { keygen, newHttpClient, randomID } from "../test-utils";

import { afterAll, expect, test } from "bun:test";
import { afterAll, expect, test, describe } from "bun:test";
import { HIncrByFloatCommand } from "./hincrbyfloat";
import { HSetCommand } from "./hset";
const client = newHttpClient();

const { newKey, cleanup } = keygen();
afterAll(cleanup);

test("a", () => {
describe("a", () => {
test("increments a non-existing value", async () => {
const key = newKey();
const field = randomID();
Expand Down
4 changes: 2 additions & 2 deletions pkg/commands/hlen.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { keygen, newHttpClient, randomID } from "../test-utils";

import { afterAll, expect, test } from "bun:test";
import { afterAll, expect, test, describe } from "bun:test";
import { HLenCommand } from "./hlen";
import { HMSetCommand } from "./hmset";

Expand All @@ -9,7 +9,7 @@ const client = newHttpClient();
const { newKey, cleanup } = keygen();
afterAll(cleanup);

test("with existing hash", () => {
describe("with existing hash", () => {
test("returns correct number of keys", async () => {
const key = newKey();
const field1 = randomID();
Expand Down
4 changes: 2 additions & 2 deletions pkg/commands/hmget.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { keygen, newHttpClient, randomID } from "../test-utils";

import { afterAll, expect, test } from "bun:test";
import { afterAll, expect, test, describe } from "bun:test";

import { HMGetCommand } from "./hmget";
import { HMSetCommand } from "./hmset";
Expand All @@ -24,7 +24,7 @@ test("gets exiting values", async () => {
expect(res2).toEqual(kv);
});

test("when the hash does not exist", () => {
describe("when the hash does not exist", () => {
test("returns null", async () => {
const key = newKey();
const res = await new HMGetCommand([key, randomID()]).exec(client);
Expand Down
14 changes: 7 additions & 7 deletions pkg/commands/hrandfield.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { afterAll, expect, test } from "bun:test";
import { afterAll, expect, test, describe } from "bun:test";
import { keygen, newHttpClient, randomID } from "../test-utils";
import { HRandFieldCommand } from "./hrandfield";
import { HSetCommand } from "./hset";
Expand All @@ -7,7 +7,7 @@ const client = newHttpClient();

const { newKey, cleanup } = keygen();
afterAll(cleanup);
test("with single field present", () => {
describe("with single field present", () => {
test("returns the field", async () => {
const key = newKey();
const field1 = randomID();
Expand All @@ -20,7 +20,7 @@ test("with single field present", () => {
});
});

test("with multiple fields present", () => {
describe("with multiple fields present", () => {
test("returns a random field", async () => {
const key = newKey();
const fields: Record<string, string> = {};
Expand All @@ -31,11 +31,11 @@ test("with multiple fields present", () => {

const res = await new HRandFieldCommand<string>([key]).exec(client);

expect(fields).toInclude(res);
expect(fields).toHaveProperty(res);
});
});

test("with withvalues", () => {
describe("with withvalues", () => {
test("returns a subset with values", async () => {
const key = newKey();
const fields: Record<string, string> = {};
Expand All @@ -46,12 +46,12 @@ test("with withvalues", () => {

const res = await new HRandFieldCommand<Record<string, string>>([key, 2, true]).exec(client);
for (const [k, v] of Object.entries(res)) {
expect(fields).toInclude(k);
expect(fields).toHaveProperty(k);
expect(fields[k]).toEqual(v);
}
});
});
test("when hash does not exist", () => {
describe("when hash does not exist", () => {
test("it returns null", async () => {
const res = await new HRandFieldCommand([randomID()]).exec(client);
expect(res).toEqual(null);
Expand Down
6 changes: 3 additions & 3 deletions pkg/commands/hsetnx.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { keygen, newHttpClient, randomID } from "../test-utils";

import { afterAll, expect, test } from "bun:test";
import { afterAll, expect, test, describe } from "bun:test";
import { HGetCommand } from "./hget";
import { HSetCommand } from "./hset";
import { HSetNXCommand } from "./hsetnx";
Expand All @@ -9,7 +9,7 @@ const client = newHttpClient();
const { newKey, cleanup } = keygen();
afterAll(cleanup);

test("when hash exists already", () => {
describe("when hash exists already", () => {
test("returns 0", async () => {
const key = newKey();
const field = randomID();
Expand All @@ -23,7 +23,7 @@ test("when hash exists already", () => {
expect(res2).toEqual(value);
});
});
test("when hash does not exist", () => {
describe("when hash does not exist", () => {
test("returns 1", async () => {
const key = newKey();
const field = randomID();
Expand Down
4 changes: 2 additions & 2 deletions pkg/commands/keys.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { afterAll, expect, test } from "bun:test";
import { afterAll, expect, test, describe } from "bun:test";
import { keygen, newHttpClient } from "../test-utils";
import { KeysCommand } from "./keys";
import { SetCommand } from "./set";
Expand All @@ -8,7 +8,7 @@ const client = newHttpClient();
const { newKey, cleanup } = keygen();
afterAll(cleanup);

test("when keys are found", () => {
describe("when keys are found", () => {
test("returns keys", async () => {
const key = newKey();
await new SetCommand([key, "value"]).exec(client);
Expand Down
8 changes: 4 additions & 4 deletions pkg/commands/lindex.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { keygen, newHttpClient, randomID } from "../test-utils";

import { afterAll, expect, test } from "bun:test";
import { afterAll, expect, test, describe } from "bun:test";
import { LIndexCommand } from "./lindex";
import { LPushCommand } from "./lpush";

Expand All @@ -9,8 +9,8 @@ const client = newHttpClient();
const { newKey, cleanup } = keygen();
afterAll(cleanup);

test("when list exists", () => {
test("when the index is in range", () => {
describe("when list exists", () => {
describe("when the index is in range", () => {
test("returns the element at index", async () => {
const key = newKey();

Expand All @@ -19,7 +19,7 @@ test("when list exists", () => {
const res = await new LIndexCommand([key, 0]).exec(client);
expect(res).toEqual(value);
});
test("when the index is out of bounds", () => {
describe("when the index is out of bounds", () => {
test("returns null", async () => {
const key = newKey();

Expand Down
6 changes: 3 additions & 3 deletions pkg/commands/llen.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { keygen, newHttpClient, randomID } from "../test-utils";

import { afterAll, expect, test } from "bun:test";
import { afterAll, expect, test, describe } from "bun:test";
import { LLenCommand } from "./llen";

import { LPushCommand } from "./lpush";
Expand All @@ -9,7 +9,7 @@ const client = newHttpClient();
const { newKey, cleanup } = keygen();
afterAll(cleanup);

test("when list exists", () => {
describe("when list exists", () => {
test("returns the length of the list", async () => {
const key = newKey();
await new LPushCommand([key, randomID()]).exec(client);
Expand All @@ -18,7 +18,7 @@ test("when list exists", () => {
});
});

test("when list does not exist", () => {
describe("when list does not exist", () => {
test("returns 0", async () => {
const key = newKey();
const res = await new LLenCommand([key]).exec(client);
Expand Down
10 changes: 5 additions & 5 deletions pkg/commands/lpop.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { keygen, newHttpClient, randomID } from "../test-utils";

import { afterAll, expect, test } from "bun:test";
import { afterAll, expect, test, describe } from "bun:test";
import { LPopCommand } from "./lpop";

import { LPushCommand } from "./lpush";
Expand All @@ -9,7 +9,7 @@ const client = newHttpClient();
const { newKey, cleanup } = keygen();
afterAll(cleanup);

test("when list exists", () => {
describe("when list exists", () => {
test("returns the first element", async () => {
const key = newKey();
const value = randomID();
Expand All @@ -19,22 +19,22 @@ test("when list exists", () => {
});
});

test("when list does not exist", () => {
describe("when list does not exist", () => {
test("returns null", async () => {
const key = newKey();
const res = await new LPopCommand([key]).exec(client);
expect(res).toEqual(null);
});
});

test("with count", () => {
describe("with count", () => {
test("returns 2 elements", async () => {
const key = newKey();
const value1 = randomID();
const value2 = randomID();
await new LPushCommand([key, value1, value2]).exec(client);
const res = await new LPopCommand<string[]>([key, 2]).exec(client);
expect(res).toBeTruthy();
expect([value1, value2]).toContain(res);
expect(res).toEqual([value2, value1]);
});
});
10 changes: 5 additions & 5 deletions pkg/commands/lpos.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { keygen, newHttpClient, randomID } from "../test-utils";

import { afterAll, expect, test } from "bun:test";
import { afterAll, expect, test, describe } from "bun:test";
import { LPosCommand } from "./lpos";

import { RPushCommand } from "./rpush";
Expand All @@ -9,7 +9,7 @@ const client = newHttpClient();
const { newKey, cleanup } = keygen();
afterAll(cleanup);

test("with single element", () => {
describe("with single element", () => {
test("returns 1", async () => {
const key = newKey();
const value1 = randomID();
Expand All @@ -20,7 +20,7 @@ test("with single element", () => {
});
});

test("with rank", () => {
describe("with rank", () => {
test("returns 6", async () => {
const key = newKey();
await new RPushCommand([key, "a", "b", "c", 1, 2, 3, "c", "c"]).exec(client);
Expand All @@ -30,7 +30,7 @@ test("with rank", () => {
expect(res).toEqual(6);
});
});
test("with count", () => {
describe("with count", () => {
test("returns 2,6", async () => {
const key = newKey();
await new RPushCommand([key, "a", "b", "c", 1, 2, 3, "c", "c"]).exec(client);
Expand All @@ -39,7 +39,7 @@ test("with count", () => {
});
});

test("with maxlen", () => {
describe("with maxlen", () => {
test("returns 2", async () => {
const key = newKey();
await new RPushCommand([key, "a", "b", "c", 1, 2, 3, "c", "c"]).exec(client);
Expand Down
6 changes: 3 additions & 3 deletions pkg/commands/lpushx.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { keygen, newHttpClient, randomID } from "../test-utils";

import { afterAll, expect, test } from "bun:test";
import { afterAll, expect, test, describe } from "bun:test";
import { LPushXCommand } from "./lpushx";

import { LPushCommand } from "./lpush";
Expand All @@ -9,7 +9,7 @@ const client = newHttpClient();
const { newKey, cleanup } = keygen();
afterAll(cleanup);

test("when list exists", () => {
describe("when list exists", () => {
test("returns the length after command", async () => {
const key = newKey();
await new LPushCommand([key, randomID()]).exec(client);
Expand All @@ -21,7 +21,7 @@ test("when list exists", () => {
});
});

test("when list does not exist", () => {
describe("when list does not exist", () => {
test("does nothing", async () => {
const key = newKey();
const res = await new LPushXCommand([key, randomID()]).exec(client);
Expand Down
6 changes: 3 additions & 3 deletions pkg/commands/ltrim.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { keygen, newHttpClient, randomID } from "../test-utils";

import { afterAll, expect, test } from "bun:test";
import { afterAll, expect, test, describe } from "bun:test";
import { LPushCommand } from "./lpush";
import { LTrimCommand } from "./ltrim";

Expand All @@ -9,7 +9,7 @@ const client = newHttpClient();
const { newKey, cleanup } = keygen();
afterAll(cleanup);

test("when the list exists", () => {
describe("when the list exists", () => {
test("returns ok", async () => {
const key = newKey();
await new LPushCommand([key, randomID()]).exec(client);
Expand All @@ -20,7 +20,7 @@ test("when the list exists", () => {
});
});

test("when the list does not exist", () => {
describe("when the list does not exist", () => {
test("returns ok", async () => {
const key = newKey();

Expand Down
4 changes: 2 additions & 2 deletions pkg/commands/pexpire.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { keygen, newHttpClient, randomID } from "../test-utils";

import { afterAll, expect, test } from "bun:test";
import { afterAll, expect, test, describe } from "bun:test";
import { GetCommand } from "./get";
import { PExpireCommand } from "./pexpire";
import { SetCommand } from "./set";
Expand All @@ -9,7 +9,7 @@ const client = newHttpClient();
const { newKey, cleanup } = keygen();
afterAll(cleanup);

test("without options", () => {
describe("without options", () => {
test("expires a key correctly", async () => {
const key = newKey();
const value = randomID();
Expand Down
Loading
Loading