mirror of
https://github.com/usebruno/bruno.git
synced 2026-06-15 20:01:28 +00:00
Previously, `{{$randomInt}}` returned values across the full JavaScript number range.
This commit updates the generator to produce integers between 0 and 1000,
matching the documented behavior.
Fixes #4847
This commit is contained in:
@@ -458,7 +458,7 @@ describe('interpolate - mock variable interpolation', () => {
|
||||
const result = interpolate(inputString, {});
|
||||
|
||||
// Validate the result using regex patterns
|
||||
const randomIntPattern = /^\d+$/;
|
||||
const randomIntPattern = /^(?:[0-9]{1,2}|[1-9][0-9]{2}|1000)$/;
|
||||
const randomIPPattern = /^([\da-f]{1,4}:){7}[\da-f]{1,4}$|^(\d{1,3}\.){3}\d{1,3}$/;
|
||||
const randomIPV4Pattern = /^(\d{1,3}\.){3}\d{1,3}$/;
|
||||
const randomIPV6Pattern = /^([\da-f]{1,4}:){7}[\da-f]{1,4}$/;
|
||||
|
||||
@@ -25,7 +25,7 @@ describe("mockDataFunctions Regex Validation", () => {
|
||||
randomNanoId: /^[\w-]{21,}$/,
|
||||
randomAlphaNumeric: /^[\w]$/,
|
||||
randomBoolean: /^(true|false)$/,
|
||||
randomInt: /^\d+$/,
|
||||
randomInt: /^(?:[0-9]{1,2}|[1-9][0-9]{2}|1000)$/,
|
||||
randomColor: /^[\w\s]+$/,
|
||||
randomHexColor: /^#[\da-f]{6}$/,
|
||||
randomAbbreviation: /^\w{2,6}$/,
|
||||
|
||||
@@ -8,7 +8,7 @@ export const mockDataFunctions = {
|
||||
randomNanoId: () => faker.string.nanoid(),
|
||||
randomAlphaNumeric: () => faker.string.alphanumeric(),
|
||||
randomBoolean: () => faker.datatype.boolean(),
|
||||
randomInt: () => faker.number.int(),
|
||||
randomInt: () => faker.number.int(1000),
|
||||
randomColor: () => faker.color.human(),
|
||||
randomHexColor: () => faker.color.rgb(),
|
||||
randomAbbreviation: () => faker.hacker.abbreviation(),
|
||||
|
||||
Reference in New Issue
Block a user