Skip to content

Commit

Permalink
adjust sanitization unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cinqisap committed Nov 27, 2024
1 parent bdbbddc commit 49bf7af
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion libs/langchain-community/src/vectorstores/hanavector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ export class HanaDB extends VectorStore {
}

/**
* Sanitizes the input to integer. Throws an error if the value is less than -1.
* Sanitizes the input to integer. Throws an error if the value is less than lower bound.
* @param inputInt The input to be sanitized.
* @returns The sanitized integer.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ describe("Sanity check tests", () => {
HanaDB.sanitizeInt("HUGO");
// eslint-disable-next-line @typescript-eslint/no-explicit-any
} catch (error: any) {
expect(error.message).toContain("must not be smaller than -1");
expect(error.message).toContain("must not be smaller than 0");
}
});

Expand All @@ -17,13 +17,13 @@ describe("Sanity check tests", () => {
});

it("should sanitize int with negative values", () => {
expect(HanaDB.sanitizeInt(-1)).toBe(-1);
expect(HanaDB.sanitizeInt("-1")).toBe(-1);
expect(HanaDB.sanitizeInt(-1, -1)).toBe(-1);
expect(HanaDB.sanitizeInt("-1", -1)).toBe(-1);
});

it("should sanitize int with illegal negative value", () => {
try {
HanaDB.sanitizeInt(-2);
HanaDB.sanitizeInt(-2, -1);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
} catch (error: any) {
expect(error.message).toContain("must not be smaller than -1");
Expand Down

0 comments on commit 49bf7af

Please sign in to comment.