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

Does your generator have a random constant? #105

Closed JeanRasin closed 4 years ago

JeanRasin commented 4 years ago

For tests, it is often convenient to manage randomness. You set a constant and the generator constantly produces the same random result. Do you have such an opportunity? image

danibram commented 4 years ago

I dont understand what you mean by a random constant, this is not a generator itself it takes the most famous generators, and packed it. So if the generators packed have this option yes, if not no. This are the generators that are included:

Faker: [https://github.com/Marak/faker.js] Chance: [https://github.com/victorquinn/chancejs] Casual: [https://github.com/boo1ean/casual] RandExpJs: [https://github.com/fent/randexp.js]

JeanRasin commented 4 years ago

For example, I need 1000 random entries. But I need them to be the same every time I start. And there is a constant from which random data is generated. Each time I have the same data set. There is such a feature in the library that I use on the backend. Very comfortably.

danibram commented 4 years ago

Hi @JeanRasin ! No sorry, the aim of the library is to be an aggregator of some libraries and provide a common interface to generate the data, so, if that agregated libraries doesnt have that option its hard for the library to implement that.

jtwebb commented 3 years ago

@danibram Faker does have that feature: http://marak.github.io/faker.js/#toc11__anchor. Do we have access to the faker object at all?

danibram commented 3 years ago

Sorry!Right now is not posible to modify the instance of faker that runs inside the generator, Im planning a completely rework, and split the generator from the generators so in that case you will be able to specify what generator you want to use, but right now its not possible. thanks!