Skip to content

Commit

Permalink
Fix MGET test
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Carbonetto <[email protected]>
  • Loading branch information
acarbonetto committed Nov 15, 2024
1 parent 87ae30a commit 22ed2ae
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
4 changes: 0 additions & 4 deletions node/tests/ServerModules.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2309,8 +2309,6 @@ describe("Server Module Tests", () => {
clusterTransaction,
);
const result = await client.exec(clusterTransaction);
console.log("result =====");
console.log(result);

validateTransactionResponse(result, expectedRes);
client.close();
Expand All @@ -2327,8 +2325,6 @@ describe("Server Module Tests", () => {
const expectedRes =
await transactionMultiJson(clusterTransaction);
const result = await client.exec(clusterTransaction);
console.log("result 2 =====");
console.log(result);

validateTransactionResponse(result, expectedRes);
client.close();
Expand Down
16 changes: 12 additions & 4 deletions node/tests/TestUtilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1728,8 +1728,6 @@ export async function transactionMultiJson(
): Promise<[string, GlideReturnType][]> {
const responseData: [string, GlideReturnType][] = [];
const key = "{key}:1" + uuidv4();
const key2 = "{key}:2" + uuidv4();
const key3 = "{key}:3" + uuidv4();
const jsonValue = { a: [1, 2], b: [3, 4], c: "c", d: true };

// JSON.SET to create a key for testing commands.
Expand Down Expand Up @@ -1772,8 +1770,18 @@ export async function transactionMultiJson(
GlideMultiJson.type(baseTransaction, key, { path: "$.a" });
responseData.push(['type(key, "$.a")', ["array"]]);

// JSON.MGET -> TODO
GlideMultiJson.mget(baseTransaction, [key, key2, key3]);
// JSON.MGET
const key2 = "{key}:2" + uuidv4();
const key3 = "{key}:3" + uuidv4();
const jsonValue2 = { b: [3, 4], c: "c", d: true };
GlideMultiJson.set(baseTransaction, key2, "$", JSON.stringify(jsonValue2));
responseData.push(['set(key2, "$")', "OK"]);

GlideMultiJson.mget(baseTransaction, [key, key2, key3], "$.a");
responseData.push([
'json.mget([key, key2, key3], "$.a")',
["[[110,120]]", "[]", null],
]);

// JSON.TOGGLE
GlideMultiJson.toggle(baseTransaction, key, { path: "$.d" });
Expand Down

0 comments on commit 22ed2ae

Please sign in to comment.