Skip to content

Commit

Permalink
ObjectType added in scan test
Browse files Browse the repository at this point in the history
Signed-off-by: Prateek Kumar <[email protected]>
  • Loading branch information
prateek-kumar-improving committed Sep 19, 2024
1 parent 7c317fe commit 7e22f0b
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 19 deletions.
10 changes: 9 additions & 1 deletion node/tests/ScanTest.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
GlideClient,
GlideClusterClient,
GlideString,
ObjectType,
ProtocolVersion,
} from "@valkey/valkey-glide";
import { v4 as uuidv4 } from "uuid";
Expand All @@ -24,6 +23,15 @@ import {

const TIMEOUT = 50000;

export enum ObjectType {
STRING = "String",
LIST = "List",
SET = "Set",
ZSET = "ZSet",
HASH = "Hash",
STREAM = "Stream",
}

//cluster tests
describe("Scan GlideClusterClient", () => {
const testsFailed = 0;
Expand Down
36 changes: 18 additions & 18 deletions node/tests/TestUtilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ export function checkFunctionListResponse(
typeof libName === "string"
? libName === lib["library_name"]
: (libName as Buffer).compare(lib["library_name"] as Buffer) ==
0;
0;

if (hasLib) {
const functions = lib["functions"];
Expand Down Expand Up @@ -537,7 +537,7 @@ export function checkFunctionStatsResponse(
if (response.running_script !== null && runningFunction.length == 0) {
fail(
"Unexpected running function info: " +
(response.running_script.command as string[]).join(" "),
(response.running_script.command as string[]).join(" "),
);
}

Expand Down Expand Up @@ -577,10 +577,10 @@ export function validateTransactionResponse(
const actual =
response?.[i] instanceof Map
? JSON.stringify(
Array.from(
(response?.[i] as ReturnTypeMap)?.entries(),
),
)
Array.from(
(response?.[i] as ReturnTypeMap)?.entries(),
),
)
: JSON.stringify(response?.[i]);
failedChecks.push(
`${testName} failed, expected <${expected}>, actual <${actual}>`,
Expand All @@ -591,7 +591,7 @@ export function validateTransactionResponse(
if (failedChecks.length > 0) {
throw new Error(
"Checks failed in transaction response:\n" +
failedChecks.join("\n"),
failedChecks.join("\n"),
);
}
}
Expand Down Expand Up @@ -1381,18 +1381,18 @@ export async function transactionTest(
'xautoclaim(key9, groupName1, consumer, 0, "0-0", { count: 1 })',
gte(version, "7.0.0")
? [
"0-0",
convertRecordToGlideRecord({
"0-2": [["field", "value2"]],
}),
[],
]
"0-0",
convertRecordToGlideRecord({
"0-2": [["field", "value2"]],
}),
[],
]
: [
"0-0",
convertRecordToGlideRecord({
"0-2": [["field", "value2"]],
}),
],
"0-0",
convertRecordToGlideRecord({
"0-2": [["field", "value2"]],
}),
],
]);
baseTransaction.xautoclaimJustId(key9, groupName1, consumer, 0, "0-0");
responseData.push([
Expand Down

0 comments on commit 7e22f0b

Please sign in to comment.