From 832de8a25e2e730ab8a459e645e3ca007be413e5 Mon Sep 17 00:00:00 2001 From: Aaron <69273634+aaron-congo@users.noreply.github.com> Date: Thu, 13 Jun 2024 12:12:41 -0700 Subject: [PATCH] Change object command names to follow camel-case (#1559) * Change object command names to follow camel-case * Update CHANGELOG --- CHANGELOG.md | 4 +-- node/src/BaseClient.ts | 8 ++--- node/src/Transaction.ts | 4 +-- node/tests/RedisClient.test.ts | 2 +- node/tests/RedisClusterClient.test.ts | 2 +- node/tests/SharedTests.ts | 46 +++++++++++++-------------- node/tests/TestUtilities.ts | 2 +- 7 files changed, 34 insertions(+), 34 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bd15282fbd..e543ab12d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,11 +15,11 @@ * Python: Added ZINTER, ZUNION commands ([#1478](https://github.com/aws/glide-for-redis/pull/1478)) * Python: Added SINTERCARD command ([#1511](https://github.com/aws/glide-for-redis/pull/1511)) * Python: Added SORT command ([#1439](https://github.com/aws/glide-for-redis/pull/1439)) -* Node: Added OBJECT ENCODING command ([#1518](https://github.com/aws/glide-for-redis/pull/1518)) +* Node: Added OBJECT ENCODING command ([#1518](https://github.com/aws/glide-for-redis/pull/1518), [#1559](https://github.com/aws/glide-for-redis/pull/1559)) * Python: Added LMOVE and BLMOVE commands ([#1536](https://github.com/aws/glide-for-redis/pull/1536)) * Node: Added SUNIONSTORE command ([#1549](https://github.com/aws/glide-for-redis/pull/1549)) * Node: Added PFCOUNT command ([#1545](https://github.com/aws/glide-for-redis/pull/1545)) -* Node: Added OBJECT FREQ command ([#1542](https://github.com/aws/glide-for-redis/pull/1542)) +* Node: Added OBJECT FREQ command ([#1542](https://github.com/aws/glide-for-redis/pull/1542), [#1559](https://github.com/aws/glide-for-redis/pull/1559)) * Node: Added LINSERT command ([#1544](https://github.com/aws/glide-for-redis/pull/1544)) * Node: Added XLEN command ([#1555](https://github.com/aws/glide-for-redis/pull/1555)) * Node: Added ZINTERCARD command ([#1553](https://github.com/aws/glide-for-redis/pull/1553)) diff --git a/node/src/BaseClient.ts b/node/src/BaseClient.ts index b849ac02ff..7987b0bc19 100644 --- a/node/src/BaseClient.ts +++ b/node/src/BaseClient.ts @@ -2549,11 +2549,11 @@ export class BaseClient { * Otherwise, returns None. * @example * ```typescript - * const result = await client.object_encoding("my_hash"); + * const result = await client.objectEncoding("my_hash"); * console.log(result); // Output: "listpack" * ``` */ - public object_encoding(key: string): Promise { + public objectEncoding(key: string): Promise { return this.createWritePromise(createObjectEncoding(key)); } @@ -2566,11 +2566,11 @@ export class BaseClient { * stored at `key` as a `number`. Otherwise, returns `null`. * @example * ```typescript - * const result = await client.object_freq("my_hash"); + * const result = await client.objectFreq("my_hash"); * console.log(result); // Output: 2 - The logarithmic access frequency counter of "my_hash". * ``` */ - public object_freq(key: string): Promise { + public objectFreq(key: string): Promise { return this.createWritePromise(createObjectFreq(key)); } diff --git a/node/src/Transaction.ts b/node/src/Transaction.ts index a496b15879..f112174806 100644 --- a/node/src/Transaction.ts +++ b/node/src/Transaction.ts @@ -1478,7 +1478,7 @@ export class BaseTransaction> { * Command Response - If `key` exists, returns the internal encoding of the object stored at `key` as a string. * Otherwise, returns None. */ - public object_encoding(key: string): T { + public objectEncoding(key: string): T { return this.addAndReturn(createObjectEncoding(key)); } @@ -1490,7 +1490,7 @@ export class BaseTransaction> { * Command Response - If `key` exists, returns the logarithmic access frequency counter of * the object stored at `key` as a `number`. Otherwise, returns `null`. */ - public object_freq(key: string): T { + public objectFreq(key: string): T { return this.addAndReturn(createObjectFreq(key)); } } diff --git a/node/tests/RedisClient.test.ts b/node/tests/RedisClient.test.ts index ff3f58a274..da4418134a 100644 --- a/node/tests/RedisClient.test.ts +++ b/node/tests/RedisClient.test.ts @@ -198,7 +198,7 @@ describe("RedisClient", () => { [maxmemoryPolicyKey]: "allkeys-lfu", }); transaction.set(key, "foo"); - transaction.object_freq(key); + transaction.objectFreq(key); const response = await client.exec(transaction); expect(response).not.toBeNull(); diff --git a/node/tests/RedisClusterClient.test.ts b/node/tests/RedisClusterClient.test.ts index 77589c9cf2..ad3e4190ae 100644 --- a/node/tests/RedisClusterClient.test.ts +++ b/node/tests/RedisClusterClient.test.ts @@ -350,7 +350,7 @@ describe("RedisClusterClient", () => { [maxmemoryPolicyKey]: "allkeys-lfu", }); transaction.set(key, "foo"); - transaction.object_freq(key); + transaction.objectFreq(key); const response = await client.exec(transaction); expect(response).not.toBeNull(); diff --git a/node/tests/SharedTests.ts b/node/tests/SharedTests.ts index 823ebe4ad3..cc0403fd57 100644 --- a/node/tests/SharedTests.ts +++ b/node/tests/SharedTests.ts @@ -3097,7 +3097,7 @@ export function runBaseTests(config: { const versionLessThan72 = await checkIfServerVersionLessThan("7.2.0"); - expect(await client.object_encoding(non_existing_key)).toEqual( + expect(await client.objectEncoding(non_existing_key)).toEqual( null, ); @@ -3107,24 +3107,24 @@ export function runBaseTests(config: { "a really loooooooooooooooooooooooooooooooooooooooong value", ), ).toEqual("OK"); - expect(await client.object_encoding(string_key)).toEqual("raw"); + expect(await client.objectEncoding(string_key)).toEqual("raw"); expect(await client.set(string_key, "2")).toEqual("OK"); - expect(await client.object_encoding(string_key)).toEqual("int"); + expect(await client.objectEncoding(string_key)).toEqual("int"); expect(await client.set(string_key, "value")).toEqual("OK"); - expect(await client.object_encoding(string_key)).toEqual( + expect(await client.objectEncoding(string_key)).toEqual( "embstr", ); expect(await client.lpush(list_key, ["1"])).toEqual(1); if (versionLessThan7) { - expect(await client.object_encoding(list_key)).toEqual( + expect(await client.objectEncoding(list_key)).toEqual( "quicklist", ); } else { - expect(await client.object_encoding(list_key)).toEqual( + expect(await client.objectEncoding(list_key)).toEqual( "listpack", ); } @@ -3136,12 +3136,12 @@ export function runBaseTests(config: { ).toEqual(1); } - expect(await client.object_encoding(hashtable_key)).toEqual( + expect(await client.objectEncoding(hashtable_key)).toEqual( "hashtable", ); expect(await client.sadd(intset_key, ["1"])).toEqual(1); - expect(await client.object_encoding(intset_key)).toEqual( + expect(await client.objectEncoding(intset_key)).toEqual( "intset", ); @@ -3149,11 +3149,11 @@ export function runBaseTests(config: { if (versionLessThan72) { expect( - await client.object_encoding(set_listpack_key), + await client.objectEncoding(set_listpack_key), ).toEqual("hashtable"); } else { expect( - await client.object_encoding(set_listpack_key), + await client.objectEncoding(set_listpack_key), ).toEqual("listpack"); } @@ -3166,9 +3166,9 @@ export function runBaseTests(config: { ).toEqual(1); } - expect( - await client.object_encoding(hash_hashtable_key), - ).toEqual("hashtable"); + expect(await client.objectEncoding(hash_hashtable_key)).toEqual( + "hashtable", + ); expect( await client.hset(hash_listpack_key, { "1": "2" }), @@ -3176,11 +3176,11 @@ export function runBaseTests(config: { if (versionLessThan7) { expect( - await client.object_encoding(hash_listpack_key), + await client.objectEncoding(hash_listpack_key), ).toEqual("ziplist"); } else { expect( - await client.object_encoding(hash_listpack_key), + await client.objectEncoding(hash_listpack_key), ).toEqual("listpack"); } @@ -3191,7 +3191,7 @@ export function runBaseTests(config: { ).toEqual(1); } - expect(await client.object_encoding(skiplist_key)).toEqual( + expect(await client.objectEncoding(skiplist_key)).toEqual( "skiplist", ); @@ -3201,18 +3201,18 @@ export function runBaseTests(config: { if (versionLessThan7) { expect( - await client.object_encoding(zset_listpack_key), + await client.objectEncoding(zset_listpack_key), ).toEqual("ziplist"); } else { expect( - await client.object_encoding(zset_listpack_key), + await client.objectEncoding(zset_listpack_key), ).toEqual("listpack"); } expect( await client.xadd(stream_key, [["field", "value"]]), ).not.toBeNull(); - expect(await client.object_encoding(stream_key)).toEqual( + expect(await client.objectEncoding(stream_key)).toEqual( "stream", ); }, protocol); @@ -3236,13 +3236,13 @@ export function runBaseTests(config: { [maxmemoryPolicyKey]: "allkeys-lfu", }), ).toEqual("OK"); - expect(await client.object_freq(nonExistingKey)).toEqual( + expect(await client.objectFreq(nonExistingKey)).toEqual( null, ); expect(await client.set(key, "foobar")).toEqual("OK"); - expect( - await client.object_freq(key), - ).toBeGreaterThanOrEqual(0); + expect(await client.objectFreq(key)).toBeGreaterThanOrEqual( + 0, + ); } finally { expect( await client.configSet({ diff --git a/node/tests/TestUtilities.ts b/node/tests/TestUtilities.ts index c063c00a6b..b5012b639b 100644 --- a/node/tests/TestUtilities.ts +++ b/node/tests/TestUtilities.ts @@ -238,7 +238,7 @@ export async function transactionTest( const args: ReturnType[] = []; baseTransaction.set(key1, "bar"); args.push("OK"); - baseTransaction.object_encoding(key1); + baseTransaction.objectEncoding(key1); args.push("embstr"); baseTransaction.type(key1); args.push("string");