Skip to content

Commit

Permalink
Add function to get random number to validate zmount size
Browse files Browse the repository at this point in the history
  • Loading branch information
samaradel committed Dec 5, 2024
1 parent 2cd0f6f commit 2aece86
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/grid_client/tests/modules/zmount.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { validate } from "class-validator";

import { Zmount } from "../../src";
import { getRandomNumber } from "../../src/helpers/utils";

describe("Zmount Class", () => {
let zmount: Zmount;
Expand Down Expand Up @@ -40,13 +41,14 @@ describe("Zmount Class", () => {
expect(() => (zmount.size = maxSize)).toThrow();
});

it("should pass validation if size is within the valid range", async () => {
it("should pass validation if size is a valid number within the range", async () => {
const validSize = getRandomNumber(minSize, maxSize);
zmount.size = validSize;

const errors = await validate(zmount);
expect(errors.length).toBe(0);
});
});

describe("challenge method", () => {
it("should return the size as a string", () => {
zmount.size = validSize;
Expand Down

0 comments on commit 2aece86

Please sign in to comment.