danibram / mocker-data-generator

A simplified way to generate masive mock data based on a schema, you can use the awesome fake/random data generators like (FakerJs, ChanceJs, CasualJs and RandExpJs)
https://danibram.github.io/mocker-data-generator/
MIT License
426 stars 45 forks source link

faker.finance.amount with arguments doesn't work #127

Open kamilwu opened 1 year ago

kamilwu commented 1 year ago

Hi, If I try to generate some data using faker.finance.amount, mocker-data-generator fails with the following error:

Error: Schema: "example" Error: "faker" Error: Max  10 should be greater than min 5.

Here's a code that can be used to reproduce the issue:

import { faker } from "@faker-js/faker";
import { mocker } from "mocker-data-generator";

mocker()
    .addGenerator("faker", faker)
    .schema("example", { amount: { faker: "finance.amount(5, 10)" } }, 1)
    .buildSync()["example"];

I'm using the following versions:

mocker-data-generator: 3.0.3 @faker-js/faker: 7.6.0